@@ -283,17 +283,18 @@ func (c *Client) CreateChatCompletionStream(
283283 }
284284
285285 // Apply structured output configuration
286- if c .ModelOptions .StructuredOutput != nil {
286+ if structuredOutput := c .ModelOptions .StructuredOutput (); structuredOutput != nil {
287+ slog .Debug ("OpenAI request using structured output" , "name" , structuredOutput .Name , "strict" , structuredOutput .Strict )
288+
287289 request .ResponseFormat = & openai.ChatCompletionResponseFormat {
288290 Type : openai .ChatCompletionResponseFormatTypeJSONSchema ,
289291 JSONSchema : & openai.ChatCompletionResponseFormatJSONSchema {
290- Name : c . ModelOptions . StructuredOutput .Name ,
291- Description : c . ModelOptions . StructuredOutput .Description ,
292- Schema : jsonSchema (c . ModelOptions . StructuredOutput .Schema ),
293- Strict : c . ModelOptions . StructuredOutput .Strict ,
292+ Name : structuredOutput .Name ,
293+ Description : structuredOutput .Description ,
294+ Schema : jsonSchema (structuredOutput .Schema ),
295+ Strict : structuredOutput .Strict ,
294296 },
295297 }
296- slog .Debug ("OpenAI request using structured output" , "name" , c .ModelOptions .StructuredOutput .Name , "strict" , c .ModelOptions .StructuredOutput .Strict )
297298 }
298299
299300 // Log the request in JSON format for debugging
0 commit comments