Skip to content

Conversation

TomeHirata
Copy link
Collaborator

@TomeHirata TomeHirata commented Sep 8, 2025

This PR increases the extensibility of dspy.Type and allows users to define a custom type that can be streamed or use native LM response. This is useful when users want to use provider specific response field such as tool call or citation.

Following methods are introduced into dspy.Type

  • is_streamable: Whether the custom type is streamable
  • parse_stream_chunk: Parse a stream chunk into the custom type
  • use_native_response: Whether to use the native response of the LM such as function calling

@TomeHirata TomeHirata changed the title Allow custom dspy type to be streamed Allow custom type to be streamed and use native response Sep 8, 2025
@TomeHirata TomeHirata requested a review from okhat September 8, 2025 08:33
@okhat
Copy link
Collaborator

okhat commented Sep 8, 2025

No concerns on a quick scan. If @chenmoneygithub approves, feel free to merge.

Copy link
Collaborator

@chenmoneygithub chenmoneygithub left a comment

Choose a reason for hiding this comment

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

Very clean and cool! Left some comments for discussion.

@TomeHirata
Copy link
Collaborator Author

@chenmoneygithub I've moved the native response type config to adapter, can you take a look again?

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.

3 participants