Skip to content

Commit

Permalink
Merge branch 'main' into deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
CNSeniorious000 committed Apr 30, 2024
2 parents 8ae10ee + c1dfb43 commit 747f983
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions src/routes/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from ..logic.tools import tool_map
from ..utils.config import env
from ..utils.http import forward_headers
from ..utils.llm import find_llm
from ..utils.llm import find_llm, groq, openai
from .sse import non_duplicated_event_stream

run_router = APIRouter(tags=["call"])
Expand Down Expand Up @@ -110,7 +110,7 @@ async def make_stream():

config = data.config

if data.model.startswith("gpt"):
if find_llm(data.model) in (openai, groq):
config["extra_headers"] = forward_headers(r.headers)

async for c in node.astream(data.context, find_llm(data.model).generate, **config):
Expand Down
1 change: 1 addition & 0 deletions src/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
6 changes: 2 additions & 4 deletions src/utils/llm/groq.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 747f983

Please sign in to comment.