Commit Graph

134 Commits

Author SHA1 Message Date
Xubin Ren
fc1ea07450 fix(custom_provider): truncate raw error body to prevent huge HTML pages
Made-with: Cursor
2026-03-20 19:12:09 +08:00
siyuan.qsy
8b971a7827 fix(custom_provider): show raw API error instead of JSONDecodeError
When an OpenAI-compatible API returns a non-JSON response (e.g. plain
text "unsupported model: xxx" with HTTP 200), the OpenAI SDK raises a
JSONDecodeError whose message is the unhelpful "Expecting value: line 1
column 1 (char 0)".  Extract the original response body from
JSONDecodeError.doc (or APIError.response.text) so users see the actual
error message from the API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 19:12:09 +08:00
Xubin Ren
728d4e88a9 fix(providers): lazy-load provider exports 2026-03-18 22:01:29 +08:00
Javis486
28127d5210 When using custom_provider, a prompt "LiteLLM:WARNING" will still appear during conversation 2026-03-18 22:01:29 +08:00
Xubin Ren
8cf11a0291 fix: preserve image paths in fallback and session history 2026-03-17 22:37:09 +08:00
Jiajun Xie
2eb0c283e9 fix(providers): handle empty choices in custom provider response 2026-03-17 14:24:55 +08:00
Xubin Ren
db37ecbfd2 fix(custom): support extraHeaders for OpenAI-compatible endpoints 2026-03-17 04:28:24 +00:00
Xubin Ren
c4628038c6 fix: handle image_url rejection by retrying without images
Replace the static provider-level supports_vision check with a
reactive fallback: when a model returns an image-unsupported error,
strip image_url blocks from messages and retry once. This avoids
maintaining an inaccurate vision capability table and correctly
handles gateway/unknown model scenarios.

Also extract _safe_chat() to deduplicate try/except boilerplate
in chat_with_retry().
2026-03-15 22:32:34 +08:00
coldxiangyu
de0b5b3d91 fix: filter image_url for non-vision models at provider layer
- Add  field to ProviderSpec (default True)
- Add  and  methods in LiteLLMProvider
- Filter image_url content blocks in  before sending to non-vision models
- Reverts session-layer filtering from original PR (wrong layer)

This fixes the issue where switching from Claude (vision-capable) to
non-vision models (e.g., Baidu Qianfan) causes API errors due to
unsupported image_url content blocks.

The provider layer is the correct place for this filtering because:
1. It has access to model/provider capabilities
2. It only affects non-vision models
3. It preserves session layer purity (storage should not know about model capabilities)
2026-03-15 22:32:34 +08:00
Xubin Ren
196e0ddbb6 fix(openrouter): revert custom_llm_provider, always apply gateway prefix 2026-03-15 10:52:36 +08:00
Xubin Ren
350d110fb9 fix(openrouter): remove litellm_prefix to prevent double-prefixed model names
With custom_llm_provider kwarg handling routing, the openrouter/ prefix
caused model names like anthropic/claude-sonnet-4-6 to become
openrouter/anthropic/claude-sonnet-4-6, which OpenRouter API rejects.
2026-03-15 10:52:36 +08:00
Paresh Mathur
445e0aa2c4 refactor(openrouter): move litellm kwargs into registry 2026-03-15 10:52:36 +08:00
Paresh Mathur
03b55791b4 fix(openrouter): preserve native model prefix 2026-03-15 10:52:36 +08:00
Xubin Ren
20b4fb3bff fix: langsmith callback 防覆盖 + 加 optional dep 2026-03-13 04:54:22 +00:00
Xubin Ren
da325e4532 Merge branch 'main' into pr-1920 2026-03-13 04:20:14 +00:00
gaoyiman
8865b6848c Merge branch 'main' into feat-volcengine-tuning 2026-03-12 14:56:05 +08: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
Re-bin
9fc74bde9a Merge remote-tracking branch 'origin/main' into pr-1874 2026-03-11 15:26:39 +00:00
Re-bin
c72c2ce7e2 refactor: move generation settings to provider level, eliminate parameter passthrough 2026-03-11 09:47:04 +00:00
WhalerO
6ef7ab53d0 refactor: centralize tool call serialization in ToolCallRequest 2026-03-11 15:32:43 +08:00
WhalerO
ed82f95f0c fix: preserve provider-specific tool call metadata for Gemini 2026-03-11 15:32:26 +08:00
Jerome Sonnet (letzdoo)
dee4f27dce feat: add Ollama as a local LLM provider
Add native Ollama support so local models (e.g. nemotron-3-nano) can be
used without an API key. Adds ProviderSpec with ollama_chat LiteLLM
prefix, ProvidersConfig field, and skips API key validation for local
providers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 08:13:14 +04:00
Re-bin
b0a5435b87 refactor(llm): share transient retry across agent paths 2026-03-10 10:10:37 +00:00
Re-bin
576ad12ef1 fix(azure): sanitize messages and handle temperature 2026-03-07 03:57:57 +00:00
Re-bin
7c074e4684 Merge remote-tracking branch 'origin/main' into pr-1618 2026-03-07 03:42:02 +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
Kunal Karmakar
73be53d4bd Add SSL verification 2026-03-06 18:16:15 +00:00
Kunal Karmakar
7e4594e08d Increase timeout for chat completion calls 2026-03-06 18:12:46 +00:00
Kunal Karmakar
a8ce0a3084 Adding some more insights for failure in Azure OpenAI calls 2026-03-06 16:05:43 +00:00
Kunal Karmakar
33c52cfb74 Merge branch 'main' of https://github.com/kunalk16/nanobot into feat-support-azure-openai 2026-03-06 10:39:29 +00:00
Kunal Karmakar
7684f5b902 Fix the temperature issue, remove temperature 2026-03-06 09:49:26 +00:00
Kunal Karmakar
52e725053c Always use temperature 1 2026-03-06 09:20:47 +00:00
Kunal Karmakar
813d37ad35 Support Azure OpenAI 2026-03-06 08:43:58 +00:00
Re-bin
dcebb94b01 style: remove trailing whitespace 2026-03-06 07:16:20 +00:00
Re-bin
ef5792162f Merge remote-tracking branch 'origin/main' into pr-1555 2026-03-06 07:15:22 +00:00
Re-bin
b817463939 chore: simplify Alibaba Coding Plan to apiBase hint, remove dedicated provider 2026-03-06 07:13:04 +00:00
Re-bin
e81b6ceb49 merge origin/main into pr-1563 2026-03-06 07:01:23 +00:00
gaoyiman
b3710165c0 Merge branch 'main' into feat-volcengine-tuning 2026-03-06 14:47:08 +08:00
Re-bin
fb77176cfd feat(custom-provider): keep instance-level session affinity header for cache locality 2026-03-05 14:25:46 +00:00
Re-bin
a3c68ef140 Merge branch 'main' into pr-1428 2026-03-05 14:12:37 +00:00
ouyangwulin
6770a6e7e9 supported aliyun coding plan. 2026-03-05 17:34:36 +08:00
ouyangwulin
cf3e7e3f38 feat: Add Alibaba Cloud Coding Plan API support
Add dashscope_coding_plan provider to registry with OpenAI-compatible
endpoint for BaiLian coding assistance.

- Supports API key detection by 'sk-sp-' prefix pattern
- Adds provider config schema entry for proper loading
- Updates documentation with configuration instructions
- Fixes duplicate MatrixConfig class issue in schema
- Follow existing nanobot provider patterns for consistency
2026-03-05 16:54:15 +08: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
gaoyiman
0d60acf2d5 fix(schema): rename volcengine_plan and byteplus_plan to *_coding_plan for consistency 2026-03-05 14:40:18 +08:00
gaoyiman
80bf5e55f1 Merge branch 'HKUDS:main' into feat-volcengine-tuning 2026-03-05 14:14:33 +08:00
Daniel Emden
ecdf309404 fix(codex): pass reasoning_effort to Codex API
The OpenAI Codex provider accepts reasoning_effort but silently
discards it. Wire it through as {"reasoning": {"effort": ...}} in
the request body so the config option actually takes effect.
2026-03-04 15:31:56 +01:00
David Markey
ecdfaf0a5a feat(custom-provider): add x-session-affinity header for prompt caching 2026-03-02 11:03:12 +00:00
Re-bin
3c79404194 fix(providers): sanitize thinking_blocks by provider and harden content normalization 2026-03-02 06:58:10 +00:00