mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-13 07:39:15 +03:00
fix(providers): preserve nanobot tools with OpenRouter server tools (#5335)
* fix(providers): preserve functions with extra body tools * docs(providers): clarify extra body tool merging
This commit is contained in:
@@ -330,7 +330,11 @@ By default, OpenAI uses `apiType: "auto"`: nanobot calls Chat Completions normal
|
||||
|
||||
Valid `apiType` values are exactly `auto`, `chat_completions`, and `responses`.
|
||||
|
||||
`extraBody` follows the selected OpenAI API surface. With Chat Completions, nanobot passes it through as the SDK `extra_body` value. With Responses, configure it in Responses API body shape; nanobot merges ordinary top-level fields into the Responses request body, appends `extraBody.tools` after generated function tools, and merges `extraBody.include` without duplicates:
|
||||
`extraBody` follows the selected OpenAI API surface. With Chat Completions, nanobot passes
|
||||
ordinary fields through as the SDK `extra_body` value; list-valued `extraBody.tools` is handled
|
||||
specially and appended after generated function tools. With Responses, configure it in Responses
|
||||
API body shape; nanobot merges ordinary top-level fields into the Responses request body, appends
|
||||
`extraBody.tools` after generated function tools, and merges `extraBody.include` without duplicates:
|
||||
|
||||
```json
|
||||
{
|
||||
|
||||
@@ -100,6 +100,29 @@ Gateway-style setup for model IDs served through OpenRouter.
|
||||
|
||||
Use the model ID exactly as OpenRouter lists it.
|
||||
|
||||
To opt into OpenRouter server-managed search and fetch, add:
|
||||
|
||||
```json
|
||||
{
|
||||
"providers": {
|
||||
"openrouter": {
|
||||
"extraBody": {
|
||||
"tools": [
|
||||
{ "type": "openrouter:web_search" },
|
||||
{ "type": "openrouter:web_fetch" }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Chat Completions-compatible OpenRouter
|
||||
[server tools](https://openrouter.ai/docs/guides/features/server-tools), such as those above, are
|
||||
appended to nanobot's generated functions. This keeps unrelated local tools such as `write_file`
|
||||
available in the same request. Responses-only server tools require an API surface that the
|
||||
OpenRouter provider does not currently enable.
|
||||
|
||||
### Eden AI Gateway
|
||||
|
||||
Eden AI exposes an OpenAI-compatible chat-completions endpoint at
|
||||
|
||||
Reference in New Issue
Block a user