39 Commits
Author SHA1 Message Date
Timothy Jaeryang BaekandClassic298 f5a26f53a0 refac
Co-Authored-By: Classic298 <27028174+Classic298@users.noreply.github.com>
2026-10-16 04:20:53 +04:00
Classic298 039867feba feat: pass the provider's finish reason to outlet filters (#32079)
Outlet filters see the finished reply with its content and token usage, but had no way to tell whether the model ended on its own, ran into the token limit or stopped to call a tool, short of reading every chunk in a stream filter. For OpenAI-compatible and Ollama models, the assistant message handed to outlet now carries finish_reason with the value the provider reported on the last model call of the turn, for streaming and non-streaming replies. Ollama replies cut off by the token limit now report length as well, where they always said stop before.
2026-10-08 19:36:47 +04:00
Timothy Jaeryang Baek 0b27fa5e87 refac 2026-08-17 00:57:57 -07:00
Timothy Jaeryang Baek bb0f898b43 refac 2026-07-31 17:41:14 -04:00
Classic298 72fdf238a8 perf: optional orjson JSON codec behind ENABLE_ORJSON (#27583)
Swap the JSON encoder/decoder used across the backend from stdlib json to
orjson when ENABLE_ORJSON is set — HTTP request bodies, JSONResponse
bodies, upstream provider responses, SSE chunks, and socket.io/Redis
payloads.

The flag defaults to off, in which case the app uses stdlib json and
engineio's codec verbatim, so default behaviour is unchanged.

- json_codec exports JSONCodec (stdlib json or the orjson codec) and
  SOCKETIO_JSON (engineio's codec or the orjson codec); call sites import
  JSONCodec and stay implementation-agnostic
- apply_orjson_http_json() is a no-op when the flag is off, leaving
  starlette's Request.json / JSONResponse.render untouched
- the orjson codec falls back to the stdlib for inputs orjson rejects
  (non-str dict keys, ints beyond 64 bits, NaN literals)
- orjson is imported only when the flag is on
- FastAPI(default_response_class=...) is deliberately not used: an
  explicit default disables the Pydantic direct-to-bytes fast path for
  response_model routes
2026-07-27 03:45:37 -04:00
Timothy Jaeryang Baek ba556bd8f0 refac 2026-07-27 02:49:08 -04:00
Timothy Jaeryang Baek df94268e89 refac 2026-07-26 18:54:07 -04:00
Timothy Jaeryang Baek 95391221df refac 2026-06-23 23:35:44 +02:00
Timothy Jaeryang Baek 6d0295588e refac: modernize type annotations (PEP 604 / PEP 585) 2026-05-12 17:10:15 +09:00
Timothy Jaeryang Baek d6b73ea2f2 refac 2026-04-24 16:31:02 +09:00
Timothy Jaeryang Baek ade617efa8 refac 2026-03-24 04:49:48 -05:00
Timothy Jaeryang Baek de3317e26b refac 2026-03-17 17:58:01 -05:00
Timothy Jaeryang Baek 0b867590a8 refac 2026-02-23 18:23:34 -06:00
Timothy Jaeryang Baek f4e99c80f6 refac: "tool_calls" finish reason support 2026-02-16 00:53:01 -06:00
Timothy Jaeryang Baek f376d4f378 chore: format 2026-02-11 16:24:11 -06:00
Timothy Jaeryang Baek 8fd5c06e5b refac 2026-02-10 12:23:08 -06:00
Tim Baek 7bb3a827bb refac 2026-02-01 08:10:25 +04:00
Tim Baek 96f106319e refac 2026-02-01 07:59:02 +04:00
EntropyYue 260137fc12 fix: ollama tool call 2025-07-18 06:11:53 +08:00
Timothy Jaeryang Baek a28bec865b refac 2025-06-10 13:16:44 +04:00
Timothy Jaeryang Baek b7a91b1963 refac: ollama response 2025-06-10 13:10:31 +04:00
Timothy Jaeryang Baek 5e35aab292 chore: format 2025-06-05 01:12:28 +04:00
henry 04da2b05f6 convert embedding function name to be more consistence 2025-06-04 18:24:27 +02:00
henry 8f6c3f46d6 payload and response modifed for compatibility 2025-06-04 16:11:40 +02:00
Simone a8859a8145 Fix on ollama to openai conversion - stream can return a single message with content 2025-02-20 21:25:32 +01:00
Timothy Jaeryang Baek eeb00a5ca2 chore: format 2025-02-20 01:01:29 -08:00
Simone 074ce356de Added OpenAI usagerequested keys 2025-02-19 15:28:39 +01:00
Timothy Jaeryang Baek eb568695e7 chore: format 2025-02-13 00:13:33 -08:00
Simone b0ade6c04c Fixed typo 2025-02-13 07:04:02 +01:00
Simone 7dc000a6b9 added support for API tool_calls if stream false 2025-02-12 09:11:26 +01:00
Timothy Jaeryang BaekandSimone 0f12c4d14f fix: ollama tool calling
Co-Authored-By: Simone <6941100+seniorsimo@users.noreply.github.com>
2025-02-10 12:18:49 -08:00
Timothy Jaeryang Baek 7766a08b70 refac: ollama tool calls 2025-02-04 21:42:49 -08:00
Timothy Jaeryang Baek 8727b91664 fix: display usage for non-streaming ollama response 2025-01-29 21:07:22 -08:00
Timothy Jaeryang Baek 46bcf98ef2 fix: usage stats 2024-12-30 15:52:07 -08:00
Timothy Jaeryang Baek e3937ada38 fix: ollama usage 2024-12-26 20:35:14 -08:00
Timothy Jaeryang Baek f9a05dd1e1 refac 2024-12-12 23:31:08 -08:00
Timothy J. Baek fc71f441c4 refac 2024-10-21 13:45:28 -07:00
Timothy J. Baek 3a0a1aca11 refac: task ollama stream support 2024-09-21 01:07:57 +02:00
Timothy J. Baek 41926172d3 fix/refac: use ollama /api/chat endpoint for tasks 2024-09-21 00:30:13 +02:00