PrefectHQ/marvin

Support Assistant-level `response_format` parameter

andehr opened this issue · 0 comments

First check

  • I added a descriptive title to this issue.
  • I used the GitHub search to look for a similar issue and didn't find it.
  • I searched the Marvin documentation for this feature.

Describe the current behavior

When creating a new assistant the Open API api endpoint allows you to specify the response format of messages from that assistant. Most importantly, this lets you require that the Assistant only responds in JSON.

Currently it appears that there's no parameter for response_format in Marvin's Assistant creation (i.e. you can't do Assistant(instructions=some_instructions, response_format=some_format)).

Describe the proposed behavior

The desired behaviour is essentially that we can send a value for the response_format parameter during instantiation of the Assistant.

Example Use

Ideally I think, we'd want something like:

Assistant(instructions=some_instructions, response_format=AssistantResponseFormat(type="json_object"))

Or even:

Assistant(instructions=some_instructions, response_format=JsonObjectAssistantResponseFormat())

Which just uses JsonObjectAssistantResponseFormat which inherits from AssistantResponseFormat but sets its type to json_object.

Additional context

I should be able to get on this today.