Skip to content

Commit fdbea33

Browse files
authored
Merge pull request #477 from krissetto/fix-structured-output
provide structured output option to provider.New
2 parents 251ca52 + c93aafa commit fdbea33

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

pkg/model/provider/dmr/client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ func (c *Client) CreateChatCompletionStream(ctx context.Context, messages []chat
364364
slog.Error("Failed to marshal DMR request to JSON", "error", err)
365365
}
366366
if c.modelOptions.StructuredOutput != nil {
367+
slog.Debug("Adding structured output to DMR request", "structured_output", c.modelOptions.StructuredOutput)
367368
request.ResponseFormat = &openai.ChatCompletionResponseFormat{
368369
Type: openai.ChatCompletionResponseFormatTypeJSONSchema,
369370
JSONSchema: &openai.ChatCompletionResponseFormatJSONSchema{

pkg/teamloader/teamloader.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,12 @@ func getModelsForAgent(ctx context.Context, cfg *latest.Config, a *latest.AgentC
221221
return nil, fmt.Errorf("model '%s' not found in configuration", name)
222222
}
223223

224-
model, err := provider.New(ctx, &modelCfg, env, options.WithGateway(runtimeConfig.ModelsGateway))
224+
opts := []options.Opt{options.WithGateway(runtimeConfig.ModelsGateway)}
225+
if a.StructuredOutput != nil {
226+
opts = append(opts, options.WithStructuredOutput(a.StructuredOutput))
227+
}
228+
229+
model, err := provider.New(ctx, &modelCfg, env, opts...)
225230
if err != nil {
226231
return nil, err
227232
}

0 commit comments

Comments
 (0)