Skip to content

Commit ed6a4d6

Browse files
committed
feat: x-strict: true in openapi spec action for assistants and agents
1 parent b5e5890 commit ed6a4d6

File tree

2 files changed

+88
-1
lines changed

2 files changed

+88
-1
lines changed

pages/docs/configuration/pre_configured_ai/assistants.mdx

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,89 @@ ASSISTANTS_BASE_URL=http://your-alt-baseURL:3080/
2828
- 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)
2929
- Specify which assistant Ids are supported or excluded [More info](/docs/configuration/librechat_yaml/object_structure/assistants_endpoint#supportedids)
3030

31+
## Strict function calling
32+
With librechat you can add add the 'x-strict': true flag at operation-level in the openapi spec for actions.
33+
This will automatically generate function calls with 'strict' mode enabled.
34+
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.
35+
36+
For example:
37+
```json filename="mathapi.json"
38+
{
39+
"openapi": "3.1.0",
40+
"info": {
41+
"title": "Math.js API",
42+
"description": "API for performing mathematical operations, such as addition, subtraction, etc.",
43+
"version": "1.0.0"
44+
},
45+
"servers": [
46+
{
47+
"url": "https://api.mathjs.org/v4"
48+
}
49+
],
50+
"paths": {
51+
"/": {
52+
"post": {
53+
"summary": "Evaluate a mathematical expression",
54+
"description": "Sends a mathematical expression in the request body to evaluate.",
55+
"operationId": "math",
56+
"x-strict": true,
57+
"parameters": [
58+
"requestBody": {
59+
"required": true,
60+
"content": {
61+
"application/json": {
62+
"schema": {
63+
"type": "object",
64+
"properties": {
65+
"expr": {
66+
"type": "string",
67+
"description": "The mathematical expression to evaluate (e.g., `2+3`)."
68+
}
69+
},
70+
"required": ["expr"]
71+
}
72+
}
73+
}
74+
},
75+
"responses": {
76+
"200": {
77+
"description": "The result of the evaluated expression.",
78+
"content": {
79+
"application/json": {
80+
"schema": {
81+
"type": "object",
82+
"properties": {
83+
"result": {
84+
"type": "number",
85+
"description": "The evaluated result of the expression."
86+
}
87+
}
88+
}
89+
}
90+
}
91+
},
92+
"400": {
93+
"description": "Invalid expression provided.",
94+
"content": {
95+
"application/json": {
96+
"schema": {
97+
"type": "object",
98+
"properties": {
99+
"error": {
100+
"type": "string",
101+
"description": "Error message describing the invalid expression."
102+
}
103+
}
104+
}
105+
}
106+
}
107+
}
108+
}
109+
}
110+
}
111+
}
112+
}
113+
```
31114

32115
<Callout type="note" title="Notes">
33116
**Notes:**
@@ -39,4 +122,5 @@ ASSISTANTS_BASE_URL=http://your-alt-baseURL:3080/
39122
- gpt-3.5-turbo-1106
40123
- Vision capability is not yet supported.
41124
- If you have previously set the [`ENDPOINTS` value in your .env file](./dotenv.md#endpoints), you will need to add the value `assistants`
42-
</Callout>
125+
</Callout>
126+

pages/docs/features/agents.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ With the Actions capability, you can dynamically create tools from [OpenAPI spec
8989
- Individual domains can be whitelisted for agent actions:
9090
- [More info](/docs/configuration/librechat_yaml/object_structure/actions#alloweddomains)
9191

92+
Note that you can add add the 'x-strict': true flag at operation-level in the OpenAPI spec for actions.
93+
If using an OpenAI model supporting it, this will automatically generate function calls with 'strict' mode enabled.
94+
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.
9295

9396
### Model Context Protocol (MCP)
9497

0 commit comments

Comments
 (0)