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

Add Litellm to supported providers in GenericLLMProvider #1060

Merged
merged 2 commits into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/docs/gpt-researcher/llms/llms.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
As described in the [introduction](/docs/gpt-researcher/gptr/config), the default LLM and embedding is OpenAI due to its superior performance and speed.
With that said, GPT Researcher supports various open/closed source LLMs and embeddings, and you can easily switch between them by updating the `SMART_LLM`, `FAST_LLM` and `EMBEDDING` env variables. You might also need to include the provider API key and corresponding configuration params.

Current supported LLMs are `openai`, `anthropic`, `azure_openai`, `cohere`, `google_vertexai`, `google_genai`, `fireworks`, `ollama`, `together`, `mistralai`, `huggingface`, `groq` and `bedrock`.
Current supported LLMs are `openai`, `anthropic`, `azure_openai`, `cohere`, `google_vertexai`, `google_genai`, `fireworks`, `ollama`, `together`, `mistralai`, `huggingface`, `groq`, `bedrock` and `litellm`.

Current supported embeddings are `openai`, `azure_openai`, `cohere`, `google_vertexai`, `google_genai`, `fireworks`, `ollama`, `together`, `mistralai`, `huggingface`, `nomic` ,`voyageai` and `bedrock`.

Expand Down Expand Up @@ -242,6 +242,15 @@ EMBEDDING="bedrock:amazon.titan-embed-text-v2:0"
```


## LiteLLM

```bash
FAST_LLM="litellm:perplexity/pplx-7b-chat"
SMART_LLM="litellm:perplexity/pplx-70b-chat"
STRATEGIC_LLM="litellm:perplexity/pplx-70b-chat"
```


## xAI

```bash
Expand Down
6 changes: 6 additions & 0 deletions gpt_researcher/llm_provider/generic/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"dashscope",
"xai",
"deepseek",
"litellm",
}


Expand Down Expand Up @@ -123,6 +124,11 @@ def from_provider(cls, provider: str, **kwargs: Any):
openai_api_key=os.environ["DEEPSEEK_API_KEY"],
**kwargs
)
elif provider == "litellm":
_check_pkg("langchain_community")
from langchain_community.chat_models.litellm import ChatLiteLLM

llm = ChatLiteLLM(**kwargs)
else:
supported = ", ".join(_SUPPORTED_PROVIDERS)
raise ValueError(
Expand Down