FormulaMonks / kurt

A wrapper for AI SDKs, for building LLM-agnostic structured AI applications in Typescript
MIT License
2 stars 0 forks source link

feat: support parallel tool calls in `KurtOpenAI` with `generateWithOptionalTools` #35

Closed jemc closed 1 month ago

jemc commented 1 month ago

This commit updates the KurtOpenAI adapter to handle the case of multiple parallel tool calls from the LLM, when being used with the generateWithOptionalTools method of Kurt.

In theory it would make sense to handle this case for generateStructuredData too, but in practice I cannot get OpenAI to respond with parallel tool calls when we are using tool_choice: { function: {...} } as we do in that method - it seems as though this option prevents parallel tool calls. If we can get this behavior to surface in practice in the future we can add logic and tests to handle that case.

Note that this resolves part of issue #33 - it resolves it for the OpenAI adapter, but not the Vertex AI adapter.

github-actions[bot] commented 1 month ago

:tada: This PR is included in version @formula-monks/kurt-open-ai-v1.4.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: