Commit Graph

65 Commits

Author SHA1 Message Date
Xubin Ren
20b4fb3bff fix: langsmith callback 防覆盖 + 加 optional dep 2026-03-13 04:54:22 +00:00
HuangMinlong
9e9051229e Integrate Langsmith for conversation tracking
Added support for Langsmith API key to enable conversation viewing.
2026-03-12 14:34:32 +08:00
Re-bin
0a0017ff45 fix: raise tool result history limit to 16k and force save_memory in consolidation 2026-03-12 03:08:53 +00:00
WhalerO
ed82f95f0c fix: preserve provider-specific tool call metadata for Gemini 2026-03-11 15:32:26 +08:00
Re-bin
576ad12ef1 fix(azure): sanitize messages and handle temperature 2026-03-07 03:57:57 +00:00
Re-bin
c94ac351f1 fix(litellm): normalize tool call ids 2026-03-07 03:30:36 +00:00
04cb
e381057356 Fix tool_call_id length error for GitHub Copilot provider
GitHub Copilot and some other providers have a 64-character limit on
tool_call_id. When switching from providers that generate longer IDs
(such as OpenAI Codex), this caused validation errors.

This fix truncates tool_call_id to 64 characters by preserving the first
32 and last 32 characters to maintain uniqueness while respecting the
provider's limit.

Fixes #1554
2026-03-07 08:31:15 +08:00
Re-bin
dcebb94b01 style: remove trailing whitespace 2026-03-06 07:16:20 +00:00
Peixian Gong
5cc3c03245 fix: merge tool_calls from multiple choices in LiteLLM response
GitHub Copilot's API returns tool_calls split across multiple choices:
- choices[0]: content only (tool_calls=null)
- choices[1]: tool_calls only (content=null)

The existing _parse_response only inspected choices[0], so tool_calls
were silently lost, causing the agent to never execute tools when using
github_copilot/ models.

This fix scans all choices and merges tool_calls + content, so
providers that return multi-choice responses work correctly.
Single-choice providers (OpenAI, Anthropic, etc.) are unaffected since
the loop over one choice is equivalent to the original code.
2026-03-05 15:15:37 +08:00
Re-bin
3c79404194 fix(providers): sanitize thinking_blocks by provider and harden content normalization 2026-03-02 06:58:10 +00:00
Jack Lu
3ee061b879 Merge branch 'main' into main 2026-03-01 13:35:24 +08:00
Re-bin
5ca386ebf5 fix: preserve reasoning_content and thinking_blocks in session history 2026-02-28 17:37:12 +00:00
Re-bin
f9d72e2e74 feat: add reasoning_effort config to enable LLM thinking mode 2026-02-28 17:18:05 +00:00
JK_Lu
977ca725f2 style: unify code formatting and import order
- Remove trailing whitespace and normalize blank lines
- Unify string quotes and line breaks for long lines
- Sort imports alphabetically across modules
2026-02-28 20:55:43 +08:00
Re-bin
1fe94898f6 fix: generate short alphanumeric tool_call_id for Mistral compatibility 2026-02-27 16:13:26 +00:00
haosenwang1018
8de2f8d588 fix: preserve reasoning_content in message sanitization for thinking models
_sanitize_messages strips all non-standard keys from messages, including
reasoning_content. Thinking-enabled models like Moonshot Kimi k2.5
require reasoning_content to be present in assistant tool call messages
when thinking mode is on, causing a BadRequestError (#1014).

Add reasoning_content to _ALLOWED_MSG_KEYS so it passes through
sanitization when present.

Fixes #1014
2026-02-24 04:21:55 +08:00
Re-bin
b653183bb0 refactor(providers): move empty content sanitization to base class 2026-02-22 18:26:42 +00:00
andienguyen-ecoligo
de63c31d43 fix(providers): normalize empty reasoning_content to None at provider level
PR #947 fixed the consumer side (context.py) but the root cause is at
the provider level — getattr returns "" (empty string) instead of None
when reasoning_content is empty. This causes DeepSeek API to reject the
request with "Missing reasoning_content field" error.

`"" or None` evaluates to None, preventing empty strings from
propagating downstream.

Fixes #946
2026-02-21 12:30:57 -05:00
Re-bin
cc04bc4dd1 fix: check gateway's supports_prompt_caching instead of always returning False 2026-02-20 15:14:45 +00:00
Re-bin
5cc019bf1a style: trim verbose comments in _sanitize_messages 2026-02-20 11:27:21 +00:00
Re-bin
0c2fea6d33 Merge branch 'main' into pr-795 2026-02-20 11:25:51 +00:00
Re-bin
9ffae47c13 refactor(litellm): remove redundant comments in cache_control methods 2026-02-20 08:21:02 +00:00
Re-bin
afa0513243 Merge branch 'main' into pr-854 2026-02-20 08:17:32 +00:00
tercerapersona
3b4763b3f9 feat: add Anthropic prompt caching via cache_control
Inject cache_control: {"type": "ephemeral"} on the system message and
last tool definition for providers that support prompt caching. Adds
supports_prompt_caching flag to ProviderSpec (enabled for Anthropic only)
and skips caching when routing through a gateway.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-19 11:05:22 -03:00
PiEgg
9789307dd6 Fix Codex provider routing for GitHub Copilot models 2026-02-19 13:30:02 +08:00
Ivan
e44f14379a fix: sanitize messages and ensure 'content' for strict LLM providers
- Strip non-standard keys like 'reasoning_content' before sending to LLM
- Always include 'content' key in assistant messages (required by StepFun)
- Add _sanitize_messages to LiteLLMProvider to prevent 400 BadRequest errors
2026-02-18 11:57:58 +03:00
Re-bin
9e5f7348fe Merge branch 'main' into pr-151 2026-02-16 09:19:40 +00:00
Re-bin
49fec3684a fix: use json_repair for robust LLM response parsing 2026-02-15 08:11:33 +00:00
The Mavik
10e9e0cdc9 fix(providers): clamp max_tokens to >= 1 before calling LiteLLM (#523) 2026-02-13 17:08:10 -05:00
qiupinhua
1ae47058d9 fix: refactor code structure for improved readability and maintainability 2026-02-13 18:51:30 +08:00
Re-bin
39dd7feb28 resolve conflicts with main and adapt MiniMax 2026-02-10 16:27:10 +00:00
Re-bin
fba5345d20 fix: pass api_key directly to litellm for more robust auth 2026-02-10 02:09:31 +00:00
Xubin Ren
8af98004b3 Merge pull request #225 from chaowu2009/main
Drop unsupported parameters for providers.
2026-02-09 03:52:52 +08:00
Re-bin
eb2fbf80da fix: use config key to detect provider, prevent api_base misidentifying as vLLM 2026-02-08 19:31:25 +00:00
Re-bin
2931694eb8 fix: preserve reasoning_content in conversation history for thinking models 2026-02-08 18:37:41 +00:00
Re-bin
299d8b33b3 refactor: replace provider if-elif chains with declarative registry 2026-02-08 07:29:31 +00:00
Re-bin
3b61ae4fff fix: skip provider prefix rules for vLLM/OpenRouter/AiHubMix endpoints 2026-02-08 04:29:51 +00:00
Vincent Wu
3c8eadffed feat: add MiniMax provider support via LiteLLM 2026-02-08 03:55:24 +08:00
Re-bin
572eab8237 feat: add AiHubMix provider support and refactor provider matching 2026-02-07 08:10:05 +00:00
Re-bin
9a98ab1747 Merge PR #145: fix Zhipu AI API key env var 2026-02-07 07:22:51 +00:00
Re-bin
18ec651b34 Merge PR #46: Add DashScope support 2026-02-07 02:52:40 +00:00
Re-bin
7c2aec99a0 resolve conflicts with main 2026-02-07 02:41:28 +00:00
Xubin Ren
771c918770 Merge pull request #205 from wcmolin/fix/zhipu-api-key
[Fix-204]: use correct ZAI_API_KEY for Zhipu/GLM models #204
2026-02-07 10:20:10 +08:00
cwu
d7b72c8f83 Drop unsupported parameters for providers. 2026-02-06 12:24:11 -05:00
Re-bin
2096645ff1 resolve conflicts with main 2026-02-06 16:56:02 +00:00
Re-bin
760a369004 feat: fix API key matching by model name 2026-02-06 08:01:20 +00:00
wcmolin
fea4a6bba8 fix: use correct ZAI_API_KEY for Zhipu/GLM models
LiteLLM's zai provider reads ZAI_API_KEY, not ZHIPUAI_API_KEY.
This fixes authentication errors when using Zhipu/GLM models.
2026-02-06 15:38:25 +08:00
mengjiechen
e680b734b1 feat: add Moonshot provider support
- Add moonshot to ProvidersConfig schema
- Add MOONSHOT_API_BASE environment variable for custom endpoint
- Handle kimi-k2.5 model temperature restriction (must be 1.0)
- Fix is_vllm detection to exclude moonshot provider

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 15:25:58 +08:00
Re-bin
301fba568b refactor: remove redundant env var setting, add DeepSeek to docs 2026-02-05 08:55:41 +00:00
Re-bin
ac45630116 resolve conflicts with main 2026-02-05 08:51:11 +00:00