Skip to content

feat: add resp format and timeout to conversation api#4129

Merged
cicoyle merged 39 commits into
dapr:mainfrom
sicoyle:feat-convo-api-more-fields
Jan 16, 2026
Merged

feat: add resp format and timeout to conversation api#4129
cicoyle merged 39 commits into
dapr:mainfrom
sicoyle:feat-convo-api-more-fields

Conversation

@sicoyle

@sicoyle sicoyle commented Dec 20, 2025

Copy link
Copy Markdown
Contributor

Description

This PR adds:

  • timeout support for llm providers on the http client and to prevent idle connections from being closed
  • response format field - this is something that users rely on. In dapr agents we do a workaround for this that I want to rm with this addition
  • i also had to bump langchain versions for some of the new options to be supported (even with the workarounds)

API PR: dapr/dapr#9241

I need this PR merged first to then merge my dapr/dapr one.

I tested conformance test on: mistral, openai, anthropic.
I have a few fixes left for ollama, and aws (this one was broken to begin with...).

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #[issue number]

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation
    • Created the dapr/docs PR:

Note: We expect contributors to open a corresponding documentation PR in the dapr/docs repository. As the implementer, you are the best person to document your work! Implementation PRs will not be merged until the documentation PR is opened and ready for review.

…che works) for convo api

Signed-off-by: Samantha Coyle <[email protected]>
@sicoyle
sicoyle requested review from a team as code owners December 20, 2025 00:02

@CasperGN CasperGN left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sicoyle does this (or the linked pr) also carry bubbling out the model, tokens etc into the metadata api like we discussed?

Comment thread conversation/echo/echo.go Outdated
@sicoyle

sicoyle commented Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

@sicoyle does this (or the linked pr) also carry bubbling out the model, tokens etc into the metadata api like we discussed?

The model was the only thing that I can remember that we want bubbled out into the metadata api. I can look to PR that later today or tomorrow :)

Comment thread conversation/aws/bedrock/bedrock.go Outdated
Comment thread conversation/converse.go Outdated
Comment on lines -42 to -50
Parameters map[string]*anypb.Any `json:"parameters"`
ConversationContext string `json:"conversationContext"`
Temperature float64 `json:"temperature"`

// from metadata
Key string `json:"key"`
Model string `json:"model"`
Endpoints []string `json:"endpoints"`
Policy string `json:"loadBalancingPolicy"`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The “from metadata” fields were bubbling the Metadata field from the Conversations API (see https://github.com/dapr/dapr/blob/master/dapr/proto/runtime/v1/ai.proto#L43
), which allowed all of these fields to be passed through the request. This is an incorrect use of metadata. Components already expose their own metadata field, so there’s no need to bubble this information up from the API—contrib already handles it.

As a result, we can remove the following fields: Key, Endpoints, and Policy.

I also removed Parameters and ConversationContext, since these were surfaced but never actually used. All of this traces back to the original implementation, which I’m now cleaning up.

Signed-off-by: Samantha Coyle <[email protected]>
@sicoyle
sicoyle requested review from JoshVanL and cicoyle January 5, 2026 22:48
Signed-off-by: Samantha Coyle <[email protected]>
Signed-off-by: Samantha Coyle <[email protected]>
@sicoyle

sicoyle commented Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

ready for feedback please @cicoyle and @JoshVanL 🙏

@sicoyle

sicoyle commented Jan 6, 2026

Copy link
Copy Markdown
Contributor Author

ignore this please as I am WIP splitting this into different PRs

@sicoyle sicoyle changed the title feat: add resp format, timeout, prompt caching, & usage to conversation api [WIP splitting this up] feat: add resp format, timeout, prompt caching, & usage to conversation api Jan 6, 2026
@sicoyle sicoyle changed the title [WIP splitting this up] feat: add resp format, timeout, prompt caching, & usage to conversation api feat: add resp format, timeout to conversation api Jan 8, 2026
@sicoyle sicoyle changed the title feat: add resp format, timeout to conversation api feat: add resp format, timeout, model override to conversation api Jan 8, 2026
Comment thread conversation/anthropic/metadata.yaml Outdated
Comment on lines +37 to +43
- name: idleConnectionTimeout
required: false
description: |
Maximum duration an idle HTTP connection can remain open before being closed.
type: duration
example: '30s'
default: '90s'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why would a user want to set this to something other than a default of 30s?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Users have seen a timeout error where the conversation was ended due to long requests, such as those using Thinking capabilities. Even something like 90s would be low depending on a conversation request. This is needed to directly unblock dapr agent users who see their connections deemed idle and dropped

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Go HTTP transport deems a connection idle only when there is no request-response in progress but there is a open connection with keep alives. The idle connection timeout should not effect the length of conversation result responses as the request-response is active so the connection is not idle.

@sicoyle sicoyle Jan 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks for questioning this @JoshVanL . I added this based on timeout issues I heard of but didn't have the full err logs so went with my best guess. I actually think the resiliency policy timeout bubbling over is sufficient for what we need, and if I need anything else then can add another PR in follow up.

JoshVanL
JoshVanL previously approved these changes Jan 15, 2026
cicoyle
cicoyle previously approved these changes Jan 15, 2026
@sicoyle

sicoyle commented Jan 15, 2026

Copy link
Copy Markdown
Contributor Author

merging even with flakey state.mysql cert test as my PR has no impact on state components at all

@sicoyle
sicoyle added this pull request to the merge queue Jan 15, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jan 15, 2026
@sicoyle
sicoyle added this pull request to the merge queue Jan 15, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jan 15, 2026
Signed-off-by: Samantha Coyle <[email protected]>
@cicoyle
cicoyle merged commit 40eb650 into dapr:main Jan 16, 2026
91 of 93 checks passed
@cicoyle cicoyle added this to the v1.17 milestone Jan 16, 2026
passuied pushed a commit to passuied/components-contrib that referenced this pull request Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants