From c1dfb4344d1056e4e1fcd3834de017c4cce6225c Mon Sep 17 00:00:00 2001 From: Muspi Merol Date: Tue, 30 Apr 2024 11:13:50 +0800 Subject: [PATCH] feat: allow gateway layer for `groq` provider chore: update deps --- pyproject.toml | 10 +++++----- src/utils/config.py | 1 + src/utils/llm/groq.py | 6 ++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8784c1e8..f119e887 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,9 +4,9 @@ requires-python = ">=3.10,<3.13" readme = "README.md" license = { text = "MIT" } dependencies = [ - "fastapi~=0.110.1", + "fastapi~=0.110.3", "uvicorn[standard]~=0.29.0", - "promplate[all]~=0.3.4.2", + "promplate[all]~=0.3.4.4", "promplate-trace[langfuse,langsmith]==0.3.0dev2", "python-box~=7.1.1", "pydantic-settings~=2.2.1", @@ -17,14 +17,14 @@ dependencies = [ "beautifulsoup4~=4.12.3", "rich~=13.7.1", "zhipuai~=2.0.1", - "anthropic~=0.25.2", - "dashscope~=1.17.0", + "anthropic~=0.25.7", + "dashscope~=1.17.1", ] [tool.pdm.dev-dependencies] dev = [ "isort~=5.13.2", - "black~=24.4.0", + "black~=24.4.2", ] [tool.pdm.scripts] diff --git a/src/utils/config.py b/src/utils/config.py index e320a059..e01ded35 100644 --- a/src/utils/config.py +++ b/src/utils/config.py @@ -12,6 +12,7 @@ class Config(BaseSettings): octoai_api_key: str = "" zhipu_api_key: str = "" groq_api_key: str = "" + groq_base_url: str = "https://api.groq.com/openai/v1" # other services serper_api_key: str = "" diff --git a/src/utils/llm/groq.py b/src/utils/llm/groq.py index 5407d8d4..54a40308 100644 --- a/src/utils/llm/groq.py +++ b/src/utils/llm/groq.py @@ -7,10 +7,8 @@ from .common import client from .dispatch import link_llm -GROQ_BASE_URL = "https://api.groq.com/openai/v1" - -complete: AsyncComplete = AsyncChatComplete(http_client=client, base_url=GROQ_BASE_URL, api_key=env.groq_api_key) -generate: AsyncGenerate = AsyncChatGenerate(http_client=client, base_url=GROQ_BASE_URL, api_key=env.groq_api_key) +complete: AsyncComplete = AsyncChatComplete(http_client=client, base_url=env.groq_base_url, api_key=env.groq_api_key) +generate: AsyncGenerate = AsyncChatGenerate(http_client=client, base_url=env.groq_base_url, api_key=env.groq_api_key) @link_llm("gemma")