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 xAI #1017

Merged
merged 2 commits into from
Dec 10, 2024
Merged

Add xAI #1017

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
1 change: 1 addition & 0 deletions backend/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class ConfigRequest(BaseModel):
SERPAPI_API_KEY: str = ''
SERPER_API_KEY: str = ''
SEARX_URL: str = ''
XAI_API_KEY: str


# App initialization
Expand Down
9 changes: 9 additions & 0 deletions docs/docs/gpt-researcher/llms/llms.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,15 @@ STRATEGIC_LLM="bedrock:anthropic.claude-3-sonnet-20240229-v1:0"
```


## xAI

```bash
FAST_LLM="xai:grok-beta"
SMART_LLM="xai:grok-beta"
STRATEGIC_LLM="xai:grok-beta"
```


## Other Embedding Models

### Nomic
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 @@ -17,6 +17,7 @@
"huggingface",
"groq",
"bedrock",
"xai",
}


Expand Down Expand Up @@ -102,6 +103,11 @@ def from_provider(cls, provider: str, **kwargs: Any):
model_id = kwargs.pop("model", None) or kwargs.pop("model_name", None)
kwargs = {"model_id": model_id, **kwargs}
llm = ChatBedrock(**kwargs)
elif provider == "xai":
_check_pkg("langchain_xai")
from langchain_xai import ChatXAI

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