Skip to content

Commit fc81bc7

Browse files
authored
add llama3 via groq (#346)
1 parent a9bd6e6 commit fc81bc7

File tree

6 files changed

+60
-7
lines changed

6 files changed

+60
-7
lines changed

backend/graph.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from langchain_core.runnables import ConfigurableField, RunnableConfig
2323
from langchain_fireworks import ChatFireworks
2424
from langchain_google_genai import ChatGoogleGenerativeAI
25+
from langchain_groq import ChatGroq
2526
from langchain_openai import ChatOpenAI
2627
from langgraph.graph import END, StateGraph, add_messages
2728

@@ -102,6 +103,7 @@
102103
FIREWORKS_MIXTRAL_MODEL_KEY = "fireworks_mixtral"
103104
GOOGLE_MODEL_KEY = "google_gemini_pro"
104105
COHERE_MODEL_KEY = "cohere_command"
106+
GROQ_LLAMA_3_MODEL_KEY = "groq_llama_3"
105107

106108

107109
def update_documents(
@@ -152,6 +154,11 @@ class AgentState(TypedDict):
152154
temperature=0,
153155
cohere_api_key=os.environ.get("COHERE_API_KEY", "not_provided"),
154156
)
157+
groq_llama3 = ChatGroq(
158+
model="llama3-70b-8192",
159+
temperature=0,
160+
groq_api_key=os.environ.get("GROQ_API_KEY", "not_provided"),
161+
)
155162
llm = gpt_3_5.configurable_alternatives(
156163
# This gives this field an id
157164
# When configuring the end runnable, we can then use this id to configure this field
@@ -162,9 +169,17 @@ class AgentState(TypedDict):
162169
FIREWORKS_MIXTRAL_MODEL_KEY: fireworks_mixtral,
163170
GOOGLE_MODEL_KEY: gemini_pro,
164171
COHERE_MODEL_KEY: cohere_command,
172+
GROQ_LLAMA_3_MODEL_KEY: groq_llama3,
165173
},
166174
).with_fallbacks(
167-
[gpt_3_5, claude_3_haiku, fireworks_mixtral, gemini_pro, cohere_command]
175+
[
176+
gpt_3_5,
177+
claude_3_haiku,
178+
fireworks_mixtral,
179+
gemini_pro,
180+
cohere_command,
181+
groq_llama3,
182+
]
168183
)
169184

170185

frontend/app/components/ChatWindow.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ export function ChatWindow() {
328328
<option value="fireworks_mixtral">
329329
Mixtral (via Fireworks.ai)
330330
</option>
331+
<option value="groq_llama_3">
332+
Llama 3 (via Groq.com)
333+
</option>
331334
<option value="cohere_command">Cohere</option>
332335
</Select>
333336
)}

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@emotion/react": "^11.11.1",
1717
"@emotion/styled": "^11.11.0",
1818
"@langchain/core": "^0.1.27",
19-
"@langchain/langgraph-sdk": "^0.0.1-rc.11",
19+
"@langchain/langgraph-sdk": "^0.0.1",
2020
"@types/dompurify": "^3.0.5",
2121
"@types/lodash.orderby": "^4.6.9",
2222
"@types/marked": "^5.0.1",

frontend/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,10 +1108,10 @@
11081108
zod "^3.22.4"
11091109
zod-to-json-schema "^3.22.3"
11101110

1111-
"@langchain/langgraph-sdk@^0.0.1-rc.11":
1112-
version "0.0.1-rc.11"
1113-
resolved "https://registry.yarnpkg.com/@langchain/langgraph-sdk/-/langgraph-sdk-0.0.1-rc.11.tgz#60488ea8e3be89f6eae698b953e4092553cc112c"
1114-
integrity sha512-KddqkTxkzaPEoOm/4CklHkSyHCnHWDNotAtFJucGTpJ1ONgLaTtvkqhbdam7V/SUkoFVd1+8FHCskPhUH8nMlQ==
1111+
"@langchain/langgraph-sdk@^0.0.1":
1112+
version "0.0.1"
1113+
resolved "https://registry.yarnpkg.com/@langchain/langgraph-sdk/-/langgraph-sdk-0.0.1.tgz#78759169f18602c9900c33380c7686cd281fe1a1"
1114+
integrity sha512-ya7PUQPfMAA2iyX/TuBmxEsIC1+Clu3nIl8M7sb8Z8rx0Xts7vtX2YDMXexEmTCN38RQmG5TNfVN860QFMKO+w==
11151115
dependencies:
11161116
"@types/json-schema" "^7.0.15"
11171117
eventsource-parser "^1.1.2"

poetry.lock

Lines changed: 35 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ langchain-openai = ">=0.1.7,<0.2.0"
1616
langchain-google-genai = ">=1.0.5,<2.0.0"
1717
langchain-anthropic = "^0.1.13"
1818
langchain-fireworks = "^0.1.3"
19+
langchain-groq = "^0.1.6"
1920
langgraph = ">=0.1.0,<0.2.0"
2021
pydantic = "1.10"
2122
beautifulsoup4 = "^4.12.2"

0 commit comments

Comments
 (0)