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 GigaChat support to chatbot and RAG #200

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
62542db
gigachat api key env
shamspias Feb 26, 2024
3a11519
add gigachat library
shamspias Feb 26, 2024
be70507
feat gigachat llm
shamspias Feb 26, 2024
c26a5fa
add gigachat llm in chatbot and RAG
shamspias Feb 26, 2024
6085c4a
Merge branch 'main' into feat/llm/gigachat
shamspias Feb 29, 2024
3163294
Merge remote-tracking branch 'origin/main' into feat/llm/gigachat
shamspias Mar 9, 2024
a1269d8
update lock for gigachat support
shamspias Mar 10, 2024
7274bfd
fix format after gigachat support
shamspias Mar 10, 2024
c97a507
Merge remote-tracking branch 'origin/main' into feat/llm/gigachat
shamspias Mar 16, 2024
66dcf89
fix gigachat support conflict with #225
shamspias Mar 16, 2024
57c3e75
fix gigachat support ruff format
shamspias Mar 16, 2024
35023f1
Merge branch 'main' into feat/llm/gigachat
shamspias Mar 16, 2024
1d9fa6f
Merge branch 'main' into feat/llm/gigachat
shamspias Mar 18, 2024
e1df5a9
Merge remote-tracking branch 'origin/main' into feat/llm/gigachat
shamspias Mar 21, 2024
0ba9fe4
fix poetry lock with gigachat support after 241
shamspias Mar 21, 2024
9a7ca0c
Merge branch 'main' into feat/llm/gigachat
shamspias Mar 21, 2024
6a3b3a9
Merge remote-tracking branch 'origin/main' into feat/llm/gigachat
shamspias Mar 21, 2024
f7ace17
fix conflict with #242 update lock
shamspias Mar 21, 2024
17a30d2
Merge branch 'main' into feat/llm/gigachat
shamspias Mar 24, 2024
32bc3f1
Merge branch 'main' into feat/llm/gigachat
shamspias Mar 25, 2024
38a6194
Merge branch 'main' into feat/llm/gigachat
shamspias Mar 31, 2024
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 .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
OPENAI_API_KEY=placeholder
ANTHROPIC_API_KEY=placeholder
GIGACHAT_API_KEY=placeholder
YDC_API_KEY=placeholder
TAVILY_API_KEY=placeholder
AZURE_OPENAI_DEPLOYMENT_NAME=placeholder
Expand Down
6 changes: 6 additions & 0 deletions backend/app/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
get_google_llm,
get_mixtral_fireworks,
get_openai_llm,
get_gigachat_llm,
)
from app.retrieval import get_retrieval_executor
from app.tools import (
Expand Down Expand Up @@ -175,6 +176,7 @@ class LLMType(str, Enum):
BEDROCK_CLAUDE2 = "Claude 2 (Amazon Bedrock)"
GEMINI = "GEMINI"
MIXTRAL = "Mixtral"
GIGACHAT = "GigaChat"


def get_chatbot(
Expand All @@ -195,6 +197,8 @@ def get_chatbot(
llm = get_google_llm()
elif llm_type == LLMType.MIXTRAL:
llm = get_mixtral_fireworks()
elif llm_type == LLMType.GIGACHAT:
llm = get_gigachat_llm()
else:
raise ValueError("Unexpected llm type")
return get_chatbot_executor(llm, system_message, CHECKPOINTER)
Expand Down Expand Up @@ -270,6 +274,8 @@ def __init__(
llm = get_google_llm()
elif llm_type == LLMType.MIXTRAL:
llm = get_mixtral_fireworks()
elif llm_type == LLMType.GIGACHAT:
llm = get_gigachat_llm()
else:
raise ValueError("Unexpected llm type")
chatbot = get_retrieval_executor(llm, retriever, system_message, CHECKPOINTER)
Expand Down
14 changes: 13 additions & 1 deletion backend/app/llms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

import boto3
import httpx
from langchain_community.chat_models import BedrockChat, ChatAnthropic, ChatFireworks
from langchain_community.chat_models import (
BedrockChat,
ChatAnthropic,
ChatFireworks,
GigaChat,
)
from langchain_google_vertexai import ChatVertexAI
from langchain_openai import AzureChatOpenAI, ChatOpenAI

Expand Down Expand Up @@ -69,3 +74,10 @@ def get_google_llm():
@lru_cache(maxsize=1)
def get_mixtral_fireworks():
return ChatFireworks(model="accounts/fireworks/models/mixtral-8x7b-instruct")


@lru_cache(maxsize=1)
def get_gigachat_llm():
return GigaChat(
credentials=os.environ.get("GIGACHAT_API_KEY"), verify_ssl_certs=False
)
Loading
Loading