Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs[minor]: Add example using LiteLLM Proxy server #6197

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

ishaan-jaff
Copy link

@ishaan-jaff ishaan-jaff commented Jul 24, 2024

Hi i'm the LiteLLM (https://github.com/BerriAI/litellm) maintainer - making this PR to add a doc on how to use LiteLLM Proxy server with Langchain JS. Please let me know if you have any suggestions / feedback

Fixes # (issue)

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 24, 2024
Copy link

vercel bot commented Jul 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 25, 2024 0:27am
langchainjs-docs ❌ Failed (Inspect) Jul 25, 2024 0:27am

@dosubot dosubot bot added the auto:documentation Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder label Jul 24, 2024
@ishaan-jaff
Copy link
Author

@jacoblee93 do you know how I can get this to appear on the sidebar - I can't find any examples on how to do so

Xnapper-2024-07-24-13 48 48

Copy link
Collaborator

@bracesproul bracesproul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good, just some nits & move code examples to code blocks. I'm converting this back to a draft, please mark as ready for review & re-request my review once implemented! Thanks

docs/core_docs/docs/integrations/chat/litellm_proxy.mdx Outdated Show resolved Hide resolved
docs/core_docs/docs/integrations/chat/litellm_proxy.mdx Outdated Show resolved Hide resolved
Comment on lines 16 to 29
```js
import { ChatOpenAI } from "@langchain/openai";

const model = new ChatOpenAI({
modelName: "claude-3-5-sonnet-20240620", // swap this for "gpt-4o-mini", "gemini-1.5-pro", "claude-3-5-sonnet-20240620"
openAIApiKey: "sk-1234",
}, {
basePath: "http://0.0.0.0:4000", // set basePath to LiteLLM Proxy server
});

const message = await model.invoke("Hi there!");

console.log(message);
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should either be an imported codeblock from the examples directory, or convert this to a notebook (use tslab to run typescript in notebooks) and have the code in cells. This way we can verify the code can be executed & run a linter/formatter across it.

Same for the rest of the typescript code blocks below

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

docs/core_docs/docs/integrations/chat/litellm_proxy.mdx Outdated Show resolved Hide resolved
docs/core_docs/docs/integrations/chat/litellm_proxy.mdx Outdated Show resolved Hide resolved
docs/core_docs/docs/integrations/chat/litellm_proxy.mdx Outdated Show resolved Hide resolved
@bracesproul bracesproul marked this pull request as draft July 24, 2024 21:31
@bracesproul bracesproul changed the title [Docs] Add example using LiteLLM Proxy server with Langchain JS docs[minor]: Add example using LiteLLM Proxy server Jul 24, 2024
@ishaan-jaff
Copy link
Author

@bracesproul do you know how I can get this to appear on the sidebar - I can't find any examples on how to do so
Xnapper-2024-07-24-13 48 48

@bracesproul
Copy link
Collaborator

Looks like the vercel deployment is failing. Could you push up a fix? Thanks

Module not found: Error: Can't resolve '@examples/models/llm/litellm_basic.ts' in '/vercel/path0/docs/core_docs/docs/integrations/chat'
Module not found: Error: Can't resolve '@examples/models/llm/litellm_azure.ts' in '/vercel/path0/docs/core_docs/docs/integrations/chat'
Module not found: Error: Can't resolve '@examples/models/llm/litellm_vertex.ts' in '/vercel/path0/docs/core_docs/docs/integrations/chat'
Module not found: Error: Can't resolve '@examples/models/llm/litellm_anthropic.ts' in '/vercel/path0/docs/core_docs/docs/integrations/chat'
[ERROR] Client bundle compiled with errors therefore further build is impossible.
Error: Command "yarn build:vercel" exited with 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:documentation Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants