mirror of
https://github.com/LibreChat-AI/librechat.ai.git
synced 2026-03-27 10:48:32 +07:00
🔨 feat: Use x-strict attribute in OpenAPI Actions for Strict Function Definition (#219)
Co-authored-by: Olivier Schiavo <olivier.schiavo@wengo.com>
This commit is contained in:
@@ -28,6 +28,89 @@ ASSISTANTS_BASE_URL=http://your-alt-baseURL:3080/
|
||||
- Set the timeout period in milliseconds for assistant runs. Helps manage system load by limiting total run operation time. [More info](/docs/configuration/librechat_yaml/object_structure/assistants_endpoint#timeoutms)
|
||||
- Specify which assistant Ids are supported or excluded [More info](/docs/configuration/librechat_yaml/object_structure/assistants_endpoint#supportedids)
|
||||
|
||||
## Strict function calling
|
||||
With librechat you can add add the 'x-strict': true flag at operation-level in the openapi spec for actions.
|
||||
This will automatically generate function calls with 'strict' mode enabled.
|
||||
Note that strict mode supports only a partial subset of json. Read https://platform.openai.com/docs/guides/structured-outputs/some-type-specific-keywords-are-not-yet-supported for details.
|
||||
|
||||
For example:
|
||||
```json filename="mathapi.json"
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"info": {
|
||||
"title": "Math.js API",
|
||||
"description": "API for performing mathematical operations, such as addition, subtraction, etc.",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://api.mathjs.org/v4"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"post": {
|
||||
"summary": "Evaluate a mathematical expression",
|
||||
"description": "Sends a mathematical expression in the request body to evaluate.",
|
||||
"operationId": "math",
|
||||
"x-strict": true,
|
||||
"parameters": [
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"expr": {
|
||||
"type": "string",
|
||||
"description": "The mathematical expression to evaluate (e.g., `2+3`)."
|
||||
}
|
||||
},
|
||||
"required": ["expr"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "The result of the evaluated expression.",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"result": {
|
||||
"type": "number",
|
||||
"description": "The evaluated result of the expression."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid expression provided.",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error": {
|
||||
"type": "string",
|
||||
"description": "Error message describing the invalid expression."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<Callout type="note" title="Notes">
|
||||
**Notes:**
|
||||
@@ -39,4 +122,5 @@ ASSISTANTS_BASE_URL=http://your-alt-baseURL:3080/
|
||||
- gpt-3.5-turbo-1106
|
||||
- Vision capability is not yet supported.
|
||||
- If you have previously set the [`ENDPOINTS` value in your .env file](./dotenv.md#endpoints), you will need to add the value `assistants`
|
||||
</Callout>
|
||||
</Callout>
|
||||
|
||||
|
||||
@@ -89,6 +89,9 @@ With the Actions capability, you can dynamically create tools from [OpenAPI spec
|
||||
- Individual domains can be whitelisted for agent actions:
|
||||
- [More info](/docs/configuration/librechat_yaml/object_structure/actions#alloweddomains)
|
||||
|
||||
Note that you can add add the 'x-strict': true flag at operation-level in the OpenAPI spec for actions.
|
||||
If using an OpenAI model supporting it, this will automatically generate function calls with 'strict' mode enabled.
|
||||
Strict mode supports only a partial subset of json. Read https://platform.openai.com/docs/guides/structured-outputs/some-type-specific-keywords-are-not-yet-supported for details.
|
||||
|
||||
### Model Context Protocol (MCP)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user