Skip to content

feat: strict tools for providers#777

Open
maksymbuleshnyi wants to merge 11 commits into
mainfrom
feat/strict-fc-providers
Open

feat: strict tools for providers#777
maksymbuleshnyi wants to merge 11 commits into
mainfrom
feat/strict-fc-providers

Conversation

@maksymbuleshnyi

@maksymbuleshnyi maksymbuleshnyi commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Note

Medium Risk
Changes how tool schemas are sent to multiple LLM providers when strict_tools is enabled; Cohere’s new extra_body injection and whitelist coercion could alter runtime behavior for agent tool calls.

Overview
Centralizes strict tool-calling JSON Schema transforms in new dynamiq/nodes/llms/_strict.py, with two shapes: OpenAI structured-outputs (all properties required, optionals as nullable unions, additionalProperties: false) and a required-omission subset (optional via required, free-form dict fields as JSON strings).

OpenAI, AzureAI, Cerebras, DeepSeek, and TogetherAI now mix in OpenAIStrictToolsMixin instead of duplicating OpenAI strict logic (large removal from openai.py). Anthropic drops its local schema cleaner and calls to_strict_subset_function. Cohere gains strict support: tightened schemas without per-tool strict, request-level strict_tools via extra_body, and a validator that coerces per-tool whitelists to full-request strict with a warning.

Reviewed by Cursor Bugbot for commit 35adc09. Bugbot is set up for automated code reviews on this repo. Configure here.

@maksymbuleshnyi maksymbuleshnyi requested a review from a team as a code owner June 10, 2026 19:46
Comment thread dynamiq/nodes/agents/base.py Outdated
Comment thread dynamiq/nodes/llms/cohere.py
@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown

Coverage

Coverage Report •
FileStmtsMissCoverMissing
dynamiq/nodes/llms
   _strict.py1291216%50–61, 75–76, 78–87, 89–97, 102, 104, 107–109, 111–112, 117–118, 122–137, 154–157, 159–166, 168, 174–176, 178–180, 200–201, 203–207, 212–214, 217–218, 223–231, 234–236, 238, 242–247, 249–251, 253, 266–273, 293
   anthropic.py813062%33–35, 39–40, 44–45, 48, 51–58, 60–61, 115, 125–131, 138, 140, 142, 178
   azureai.py10190%29
   cerebras.py10190%25
   cohere.py281450%42–45, 50–51, 59–61, 70, 80–83
   deepseek.py10190%31
   togetherai.py10190%32
TOTAL33335971570% 

Tests Skipped Failures Errors Time
2448 2 💤 0 ❌ 0 🔥 2m 53s ⏱️

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ee81b72. Configure here.

Comment thread dynamiq/nodes/llms/cohere.py
@maksymbuleshnyi maksymbuleshnyi added the run-integration-tests-with-creds Trigger integration tests with credentials (optional) label Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-integration-tests-with-creds Trigger integration tests with credentials (optional)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant