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 Dec 8, 2024
2 parents 13454a2 + bcc7dcc commit e6ef68b
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions src/logic/tools/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/routes/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
11 changes: 7 additions & 4 deletions src/utils/llm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/utils/llm/groq.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 1 addition & 3 deletions src/utils/response.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from operator import call
from traceback import print_exc

from fastapi.responses import PlainTextResponse, StreamingResponse
Expand All @@ -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)

0 comments on commit e6ef68b

Please sign in to comment.