Skip to content

Commit

Permalink
Merge pull request #1017 from winsonluk/x
Browse files Browse the repository at this point in the history
Add xAI
  • Loading branch information
assafelovic authored Dec 10, 2024
2 parents bbbc900 + a36eed6 commit 27f4703
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
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

0 comments on commit 27f4703

Please sign in to comment.