1010 Commits

Author SHA1 Message Date
Timothy Jaeryang Baek
f7406ff576 refac 2026-02-09 13:28:14 -06:00
Timothy Jaeryang Baek
5669d1062c refac 2026-02-04 21:54:45 -06:00
Timothy Jaeryang Baek
3ace75820e refac 2026-02-04 21:46:20 -06:00
Timothy Jaeryang Baek
020cb0d4bf refac 2026-02-04 21:09:05 -06:00
Timothy Jaeryang Baek
8b75d34a8a refac 2026-02-04 21:07:30 -06:00
Timothy Jaeryang Baek
6320a9aaa9 refac 2026-02-04 20:47:21 -06:00
Thomas Rehn
654172d757 fix: redis clustermode instrumentation 2026-02-03 15:25:37 +01:00
Tim Baek
cfd30581d5 Merge branch 'dev' into chat-message-rebased 2026-02-02 09:33:41 -06:00
Timothy Jaeryang Baek
117c091b95 refac 2026-02-01 20:07:11 -06:00
Timothy Jaeryang Baek
6ffce4bccd refac 2026-02-01 20:00:21 -06:00
Timothy Jaeryang Baek
ea9c58ea80 feat: experimental responses api support 2026-02-01 19:39:28 -06:00
Tim Baek
3da4323ef3 refac 2026-02-01 10:11:13 +04:00
Tim Baek
75e5a485d2 refac 2026-02-01 10:06:52 +04: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
Classic298
aac98120c8 perf: batch fetch filter functions to eliminate N+1 queries (#21018) 2026-01-30 00:50:04 +04:00
Cevat Batuhan Tolon
567b0776cd REDIS_RECONNECT_DELAY as positive float for handle retry delay on timeout/connection errors (#21021) 2026-01-29 17:13:03 +04:00
Timothy Jaeryang Baek
665f95eda3 refac 2026-01-28 01:18:39 +04:00
Timothy Jaeryang Baek
4a55167759 refac 2026-01-26 18:04:58 +04:00
Tim Baek
6359628bc3 refac 2026-01-26 07:01:05 -05:00
Tim Baek
0dc74a8a2e refac 2026-01-23 08:33:21 -05:00
Tim Baek
90a057f400 refac 2026-01-23 08:25:19 -05:00
Tim Baek
d2c695eb11 feat: add convert_output_to_messages for OR-aligned message building 2026-01-22 19:54:05 -05:00
Timothy Jaeryang Baek
52c73390f8 refac 2026-01-23 01:44:48 +04:00
Timothy Jaeryang Baek
c46ef3b63b enh: builtin tools model editor 2026-01-23 01:40:18 +04:00
Tim Baek
86e6b2b68b refac: audit 2026-01-22 16:18:16 -05:00
Classic298
5a0488bb18 init (#20881) 2026-01-22 20:30:07 +04:00
Timothy Jaeryang Baek
c7f996d593 refac: AIOHTTP_CLIENT_SESSION_TOOL_SERVER_SSL for mcp connections 2026-01-22 18:30:16 +04:00
Timothy Jaeryang Baek
14f6747dfc refac 2026-01-22 15:07:14 +04:00
Timothy Jaeryang Baek
886c12c566 refac 2026-01-22 14:54:00 +04:00
Timothy Jaeryang Baek
474427c67e enh: dynamic select options valve 2026-01-22 03:55:07 +04:00
Classic298
38bf0b6eec feat: Add new ENV VAR for custom error message on error on signup / password change due to password not meeting requirements (#20650)
* add env var for custom auth pw message

* Update auth.py

* Update auth.py
2026-01-19 14:00:48 +04:00
Classic298
af584b46f4 feat: code-interpreter native (#20592)
* code-interpreter native

* Update tools.py

* Update builtin.py

* Update builtin.py

* Update tools.py

* Update builtin.py

* Update builtin.py

* Update builtin.py

* Update builtin.py

* Update builtin.py

* Update builtin.py

* Update builtin.py

* Update builtin.py

* Update builtin.py

* Update builtin.py
2026-01-12 00:18:41 +04:00
Timothy Jaeryang Baek
d56bb2c383 refac 2026-01-11 00:52:43 +04:00
Classic298
3f133fad56 fix: release database connections immediately after auth instead of holding during LLM calls (#20545)
fix: release database connections immediately after auth instead of holding during LLM calls

Authentication was using Depends(get_session) which holds a database connection
for the entire request lifecycle. For chat completions, this meant connections
were held for 30-60 seconds while waiting for LLM responses, despite only needing
the connection for ~50ms of actual database work.

With a default pool of 15 connections, this limited concurrent chat users to ~15
before pool exhaustion and timeout errors:

    sqlalchemy.exc.TimeoutError: QueuePool limit of size 5 overflow 10 reached,
    connection timed out, timeout 30.00

The fix removes Depends(get_session) from get_current_user. Each database
operation now manages its own short-lived session internally:

    BEFORE: One session held for entire request
    ──────────────────────────────────────────────────
    │ auth │ queries │ LLM wait (30s) │ save │
    │         CONNECTION HELD ENTIRE TIME            │
    ──────────────────────────────────────────────────

    AFTER: Short-lived sessions, released immediately
    ┌──────┐ ┌───────┐                 ┌──────┐
    │ auth │ │ query │   LLM (30s)     │ save │
    │ 10ms │ │ 20ms  │  NO CONNECTION  │ 20ms │
    └──────┘ └───────┘                 └──────┘

This is safe because:
- User model has no lazy-loaded relationships (all simple columns)
- Pydantic conversion (UserModel.model_validate) happens while session is open
- Returned object is pure Pydantic with no SQLAlchemy ties

Combined with the telemetry efficiency fix, this resolves connection pool
exhaustion for high-concurrency deployments, particularly on network-attached
databases like AWS Aurora where connection hold time is more impactful.
2026-01-10 15:34:36 +04:00
Classic298
7839d043ff fix: use efficient COUNT queries in telemetry metrics to prevent connection pool exhaustion (#20542)
fix: use efficient COUNT queries in telemetry metrics to prevent connection pool exhaustion

This fixes database connection pool exhaustion issues reported after v0.7.0,
particularly affecting PostgreSQL deployments on high-latency networks (e.g., AWS Aurora).

## The Problem

The telemetry metrics callbacks (running every 10 seconds via OpenTelemetry's
PeriodicExportingMetricReader) were using inefficient queries that loaded entire
database tables into memory just to count records:

    len(Users.get_users()["users"])  # Loads ALL user records to count them

On high-latency network-attached databases like AWS Aurora, this would:
1. Hold database connections for hundreds of milliseconds while transferring data
2. Deserialize all records into Python objects
3. Only then count the list length

Under concurrent load, these long-held connections would stack up and drain the
connection pool, resulting in:

    sqlalchemy.exc.TimeoutError: QueuePool limit of size 5 overflow 10 reached,
    connection timed out, timeout 30.00

## The Fix

Replace inefficient full-table loads with efficient COUNT(*) queries using
methods that already exist in the codebase:

- `len(Users.get_users()["users"])` → `Users.get_num_users()`
- Similar changes for other telemetry callbacks as needed

COUNT(*) queries use database indexes and return a single integer, completing in
~5-10ms even on Aurora, versus potentially 500ms+ for loading all records.

## Why v0.7.1's Session Sharing Disable "Helped"

The v0.7.1 change to disable DATABASE_ENABLE_SESSION_SHARING by default appeared
to fix the issue, but it was masking the root cause. Disabling session sharing
causes connections to be returned to the pool faster (more connection churn),
which reduced the window for pool exhaustion but didn't address the underlying
inefficient queries.

With this fix, session sharing can be safely re-enabled for deployments that
benefit from it (especially PostgreSQL), as telemetry will no longer hold
connections for extended periods.

## Impact

- Telemetry connection usage drops from potentially seconds to ~30ms total per
  collection cycle
- Connection pool pressure from telemetry becomes negligible (~0.3% utilization)
- Enterprise PostgreSQL deployments (Aurora, RDS, etc.) should no longer
  experience pool exhaustion under normal load
2026-01-10 15:33:42 +04:00
Timothy Jaeryang Baek
3c986adeda enh: kb metadata search 2026-01-09 22:21:00 +04:00
Tim Baek
daccf0713e enh: file context model setting 2026-01-09 03:41:43 -05:00
Timothy Jaeryang Baek
1138929f4d feat: headless admin creation 2026-01-09 12:01:36 +04:00
Timothy Jaeryang Baek
b377e5ff4c chore: format 2026-01-09 02:46:04 +04:00
Timothy Jaeryang Baek
9223efaff0 fix: native function calling system prompt duplication 2026-01-08 23:08:47 +04:00
Timothy Jaeryang Baek
9b06fdc8fe refac 2026-01-08 03:37:11 +04:00
Timothy Jaeryang Baek
700349064d chore: format 2026-01-08 01:55:56 +04:00
Timothy Jaeryang Baek
c417fdd94d refac 2026-01-08 01:38:40 +04:00
Timothy Jaeryang Baek
e67891a374 refac 2026-01-08 00:42:29 +04:00
Tim Baek
0654df7bdb refac 2026-01-07 10:25:13 -05:00
Tim Baek
35d385e9cc refac 2026-01-07 10:21:05 -05:00
Tim Baek
ab400e3eae enh: native tool citations
Co-Authored-By: Jannik S. <jannik@streidl.dev>
2026-01-07 10:14:45 -05:00
Tim Baek
961136413f refac 2026-01-07 09:46:07 -05:00
Tim Baek
c8622adcb0 feat: builtin kb tools 2026-01-07 08:58:58 -05:00