Spaces:
Build error
Build error
Romain Lembo
commited on
Commit
·
e679d7f
1
Parent(s):
1a5c922
Add ChatLiteLLM integration and update requirements
Browse files- agent.py +9 -1
- requirements.txt +1 -0
agent.py
CHANGED
|
@@ -11,6 +11,7 @@ from langchain_community.vectorstores import SupabaseVectorStore
|
|
| 11 |
from langchain_core.messages import SystemMessage, HumanMessage
|
| 12 |
from langchain.tools.retriever import create_retriever_tool
|
| 13 |
from supabase.client import Client, create_client
|
|
|
|
| 14 |
|
| 15 |
# Tools
|
| 16 |
from tools.wiki_search import wiki_search
|
|
@@ -88,8 +89,15 @@ def build_graph(provider: str = "google"):
|
|
| 88 |
# "mosaicml/mpt-7b-instruct"
|
| 89 |
# "tiiuae/falcon-7b-instruct"
|
| 90 |
token=os.environ.get("HF_TOKEN"),
|
| 91 |
-
)
|
| 92 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
else:
|
| 94 |
raise ValueError("Invalid provider. Choose 'google', 'groq' or 'huggingface'.")
|
| 95 |
# Bind tools to LLM
|
|
|
|
| 11 |
from langchain_core.messages import SystemMessage, HumanMessage
|
| 12 |
from langchain.tools.retriever import create_retriever_tool
|
| 13 |
from supabase.client import Client, create_client
|
| 14 |
+
from langchain_litellm import ChatLiteLLM
|
| 15 |
|
| 16 |
# Tools
|
| 17 |
from tools.wiki_search import wiki_search
|
|
|
|
| 89 |
# "mosaicml/mpt-7b-instruct"
|
| 90 |
# "tiiuae/falcon-7b-instruct"
|
| 91 |
token=os.environ.get("HF_TOKEN"),
|
| 92 |
+
)
|
| 93 |
)
|
| 94 |
+
elif provider == "litellm":
|
| 95 |
+
# HuggingFace Embeddings
|
| 96 |
+
llm = ChatLiteLLM(
|
| 97 |
+
model_id="ollama_chat/qwen2:7b",
|
| 98 |
+
api_base="http://127.0.0.1:11434",
|
| 99 |
+
num_ctx=8192,
|
| 100 |
+
)
|
| 101 |
else:
|
| 102 |
raise ValueError("Invalid provider. Choose 'google', 'groq' or 'huggingface'.")
|
| 103 |
# Bind tools to LLM
|
requirements.txt
CHANGED
|
@@ -10,6 +10,7 @@ langchain-huggingface
|
|
| 10 |
langchain-groq
|
| 11 |
langchain-tavily
|
| 12 |
langchain-chroma
|
|
|
|
| 13 |
langgraph
|
| 14 |
|
| 15 |
# Dependencies for various integrations
|
|
|
|
| 10 |
langchain-groq
|
| 11 |
langchain-tavily
|
| 12 |
langchain-chroma
|
| 13 |
+
langchain-litellm
|
| 14 |
langgraph
|
| 15 |
|
| 16 |
# Dependencies for various integrations
|