Skip to content

Commit bab5587

Browse files
authored
Merge pull request #66 from vithursant/vithu-dev/cerebras-api
feat: Add Cerebras API via llama-index
2 parents 77f7a3a + 2426d79 commit bab5587

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
MISTRAL_API_KEY=""
22
OPENAI_API_KEY=""
33
GROK_API_KEY=""
4+
CEREBRAS_API_KEY=""
45
DISABLE_LLM="False"
56

67
# AWS credentials

agent/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
},
1818
"GROQ": {"groq:gemma-7b-it"},
1919
"ANTHROPIC": {"anthropic:claude-3-haiku-20240307"},
20+
"CEREBRAS": {"cerebras:llama3.1-8b",
21+
"cerebras:llama3.1-70b"}
2022
}
2123

2224

agent/llm.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,8 @@ def get_client(model_str):
3232
from llama_index.llms.bedrock import Bedrock
3333

3434
return Bedrock(model=model_name)
35+
elif provider == "cerebras":
36+
from llama_index.llms.cerebras import Cerebras
37+
38+
return Cerebras(model=model_name)
39+

eval/game.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ def verify_provider_name(self):
4747
assert (
4848
os.environ.get("MISTRAL_API_KEY") is not None
4949
), "Mistral API key not set"
50-
50+
if self.model.startswith("cerebras"):
51+
assert (
52+
os.environ.get("CEREBRAS_API_KEY") is not None
53+
), "Cerebras API key not set"
5154

5255
class Player1(Player):
5356
def __init__(

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ llama-index-llms-anthropic
5353
llama-index-llms-groq
5454
llama-index-llms-ollama
5555
llama-index-llms-bedrock
56+
llama-index-llms-cerebras

0 commit comments

Comments
 (0)