diff --git a/pyproject.toml b/pyproject.toml index 8221957..2daf7f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,16 +12,16 @@ dependencies = [ "promplate-trace[langfuse,langsmith]==0.3.0dev5", "python-box~=7.2.0", "pydantic-settings~=2.6.0", - "httpx[http2]~=0.27.0", + "httpx[http2]~=0.28.0", "promptools[stream,validation]~=0.1.3.3", - "fake-useragent~=1.5.1", + "fake-useragent~=2.0.0", "html2text~=2024.2.26", "beautifulsoup4~=4.12.3", "rich~=13.9.0", - "zhipuai~=2.1.0.20240521", - "anthropic~=0.37.1", + "zhipuai~=2.1.5.20241203", + "anthropic~=0.40.0", "dashscope~=1.20.2", - "logfire[fastapi,system-metrics,httpx]~=2.1.1", + "logfire[fastapi,system-metrics,httpx]~=2.6.0", ] [tool.pdm] diff --git a/src/logic/tools/fetch.py b/src/logic/tools/fetch.py index 57c38f6..8b216f9 100644 --- a/src/logic/tools/fetch.py +++ b/src/logic/tools/fetch.py @@ -4,13 +4,13 @@ from typing import cast from bs4 import BeautifulSoup -from fake_useragent import UserAgent +from fake_useragent.fake import FakeUserAgent from html2text import html2text from httpx import AsyncClient, HTTPError from .base import AbstractTool -ua = UserAgent(min_percentage=0.5) +ua = FakeUserAgent(min_percentage=0.5) class Browser(AbstractTool): diff --git a/src/routes/openai.py b/src/routes/openai.py index 2830af7..6880dea 100644 --- a/src/routes/openai.py +++ b/src/routes/openai.py @@ -33,7 +33,7 @@ class ChatInput(ChainInput): @property def config(self): - return self.model_dump(exclude_unset=True) + return self.model_dump(exclude_unset=True, exclude={"messages"}) def mix_config(r: Request, data: ChatInput): diff --git a/src/utils/llm/__init__.py b/src/utils/llm/__init__.py index ae7a46a..635eba0 100644 --- a/src/utils/llm/__init__.py +++ b/src/utils/llm/__init__.py @@ -68,11 +68,14 @@ "llama3-70b-8192", "llama-3.1-8b-instant", "llama-3.1-70b-versatile", + "llama-3.1-70b-specdec", "llama-3.1-405b-reasoning", - "llama-3.2-1b-text-preview", - "llama-3.2-3b-text-preview", - "llama-3.2-11b-text-preview", - "llama-3.2-90b-text-preview", + "llama-3.2-1b-preview", + "llama-3.2-3b-preview", + "llama-3.2-11b-vision-preview", + "llama-3.2-90b-vision-preview", + "llama-3.3-70b-versatile", + "llama-3.3-70b-specdec", "llama3.1-8b", "llama3.1-70b", "mixtral-8x7b-32768", diff --git a/src/utils/llm/groq.py b/src/utils/llm/groq.py index c6509ae..41a956e 100644 --- a/src/utils/llm/groq.py +++ b/src/utils/llm/groq.py @@ -16,6 +16,7 @@ @link_llm("llama3-") @link_llm("llama-3.1") @link_llm("llama-3.2") +@link_llm("llama-3.3") @link_llm("mixtral") class Groq(AsyncChatOpenAI): async def complete(self, prompt: str | list[Message], /, **config): diff --git a/src/utils/response.py b/src/utils/response.py index 3ddda44..f1dc309 100644 --- a/src/utils/response.py +++ b/src/utils/response.py @@ -1,4 +1,3 @@ -from operator import call from traceback import print_exc from fastapi.responses import PlainTextResponse, StreamingResponse @@ -14,10 +13,9 @@ async def make_response(stream: AsyncContentStream, media_type="text/plain"): print_exc() return PlainTextResponse("\n".join(map(str, e.args)).strip(), getattr(e, "status_code", 500)) - @call async def _(): yield first_chunk async for i in it: yield i - return StreamingResponse(_, media_type=media_type) + return StreamingResponse(_(), media_type=media_type)