diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 1f2c3195..e4e24d3f 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -7,15 +7,16 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v1 - name: Install dependencies working-directory: frontend run: | - yarn install + bun install - name: Run svelte-check working-directory: frontend run: | - yarn check + bun check - name: Run prettier working-directory: frontend run: | - yarn prettier --check . --ignore-path ../.gitignore + bun prettier --check . --ignore-path ../.gitignore diff --git a/frontend/app/HeroPage.svelte b/frontend/app/HeroPage.svelte index eb44de43..c4402590 100644 --- a/frontend/app/HeroPage.svelte +++ b/frontend/app/HeroPage.svelte @@ -5,7 +5,7 @@ import { tweened } from "svelte/motion"; const length = 20; - let i = tweened(length * 1.3, { easing: sineInOut, duration: 700 }); + const i = tweened(length * 1.3, { easing: sineInOut, duration: 700 }); onMount(() => ($i = 0)); diff --git a/frontend/package.json b/frontend/package.json index 8989c154..d704ee39 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,24 +12,24 @@ "check": "svelte-check --tsconfig ./tsconfig.json" }, "devDependencies": { - "@antfu/eslint-config": "^2.15.0", + "@antfu/eslint-config": "^2.21.1", "@promplate/pattern": "^0.0.1", - "@sveltejs/vite-plugin-svelte": "^3.1.0", + "@sveltejs/vite-plugin-svelte": "^3.1.1", "@tsconfig/svelte": "^5.0.4", - "@unocss/eslint-plugin": "^0.59.3", - "@unocss/extractor-svelte": "^0.59.3", - "@unocss/reset": "^0.59.3", - "eslint": "^8.57.0", + "@unocss/eslint-plugin": "^0.61.0", + "@unocss/extractor-svelte": "^0.61.0", + "@unocss/reset": "^0.61.0", + "eslint": "^9.4.0", "eslint-plugin-format": "^0.1.1", - "eslint-plugin-svelte": "^2.37.0", - "prettier": "^3.2.5", - "prettier-plugin-svelte": "^3.2.3", - "svelte": "^4.2.15", - "svelte-check": "^3.6.9", - "svelte-eslint-parser": "^0.33.1", - "tslib": "^2.6.2", + "eslint-plugin-svelte": "^2.39.3", + "prettier": "^3.3.2", + "prettier-plugin-svelte": "^3.2.4", + "svelte": "^4.2.18", + "svelte-check": "^3.8.0", + "svelte-eslint-parser": "^0.37.0", + "tslib": "^2.6.3", "typescript": "^5.4.5", - "unocss": "^0.59.3", - "vite": "^5.2.9" + "unocss": "^0.61.0", + "vite": "^5.3.1" } } diff --git a/pyproject.toml b/pyproject.toml index 12ac1619..09b34f2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,20 +7,21 @@ readme = "README.md" license = { text = "MIT" } dependencies = [ "fastapi-slim~=0.111.0", - "uvicorn[standard]~=0.29.0", - "promplate[all]~=0.3.4.4", - "promplate-trace[langfuse,langsmith]==0.3.0dev2", + "uvicorn[standard]~=0.30.1", + "promplate[all]~=0.3.4.7", + "promplate-trace[langfuse,langsmith]==0.3.0dev5", "python-box~=7.1.1", - "pydantic-settings~=2.2.1", + "pydantic-settings~=2.3.1", "httpx[http2]~=0.27.0", "promptools[stream,validation]~=0.1.3.3", "fake-useragent~=1.5.1", "html2text~=2024.2.26", "beautifulsoup4~=4.12.3", "rich~=13.7.1", - "zhipuai~=2.0.1", - "anthropic~=0.25.8", - "dashscope~=1.19.0", + "zhipuai~=2.1.0.20240521", + "anthropic~=0.28.0", + "dashscope~=1.19.2", + "logfire[fastapi,system-metrics]~=0.42.0", ] [tool.pdm] diff --git a/src/__init__.py b/src/__init__.py index bcd8cb17..90b73a23 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -6,6 +6,7 @@ from .routes.prompts import prompts_router from .routes.run import run_router +from .utils.config import env from .utils.load import generate_pyi from .utils.time import now @@ -21,3 +22,12 @@ async def greet(): app.mount("/", StaticFiles(directory="frontend/dist", html=True, check_dir=False)) + +if env.logfire_token: + import logfire + + logfire.configure() + logfire.info("app started", **env.model_dump()) + logfire.instrument_openai() + logfire.instrument_anthropic() + logfire.instrument_fastapi(app) diff --git a/src/utils/config.py b/src/utils/config.py index e01ded35..b1669736 100644 --- a/src/utils/config.py +++ b/src/utils/config.py @@ -16,6 +16,7 @@ class Config(BaseSettings): # other services serper_api_key: str = "" + logfire_token: str = "" base_path: str = "" diff --git a/src/utils/llm/anthropic.py b/src/utils/llm/anthropic.py index d9fc142a..2c363ab5 100644 --- a/src/utils/llm/anthropic.py +++ b/src/utils/llm/anthropic.py @@ -37,7 +37,7 @@ async def generate(prompt: str | list[Message], /, **config): ) as stream: async for event in stream: if event.type == "content_block_delta": - yield event.delta.text + yield getattr(event.delta, "text", "") @link_llm("claude")