Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update assistant request sends unsupported temperature parameter for models that don’t support it #217

Open
bielcarpi opened this issue Feb 6, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@bielcarpi
Copy link

Description

When calling the assistant update endpoint using the provided Go client (specifically via the UpdateAssistantOnOpenAI method), the generated JSON payload inadvertently includes the temperature field—even when I don't explicitly set it in my update configuration. This causes the API to reject the request with a 400 Bad Request error and the following message:

Unsupported parameter: 'temperature' is not supported with this model.

The problem appears to be caused by the way the library's BetaAssistantUpdateParams struct is defined. Since it includes a field for temperature:

Temperature param.Field[float64] `json:"temperature"`

—even when no value is set—the default (or zero) value is serialized and sent in the payload. For models that do not support a temperature parameter (such as o1 and o3-mini), this leads to an error.

Steps to Reproduce

Use the client's update method similar to the following snippet (note that no temperature is being explicitly provided):

toolResources := openailib.BetaAssistantUpdateParamsToolResources{
    FileSearch: openailib.F(openailib.BetaAssistantUpdateParamsToolResourcesFileSearch{
        VectorStoreIDs: openailib.F([]string{s.vectorStoreID}),
    }),
}
tools := []openailib.AssistantToolUnionParam{
    openailib.FileSearchToolParam{
        Type:       openailib.F(openailib.FileSearchToolTypeFileSearch),
        FileSearch: openailib.F(openailib.FileSearchToolFileSearchParam{}),
    },
}

params := openailib.BetaAssistantUpdateParams{
    Description:   openailib.F(cfg.Description),
    Instructions:  openailib.F(fullInstructions),
    Model:         openailib.F(cfg.Model),
    Name:          openailib.F(cfg.Name),
    ToolResources: openailib.F(toolResources),
    Tools:         openailib.F(tools),
    TopP:          openailib.F(0.0), // example value for top_p
    // Temperature is not explicitly set, but still gets serialized
}

if _, err := s.client.Beta.Assistants.Update(ctx, externalAssistantID, params); err != nil {
    return fmt.Errorf("error updating assistant on openai: %w", err)
}

Observe that the request payload still includes the "temperature" field, which then triggers the error.

Expected Behavior

If no temperature value is explicitly provided, the client should omit the temperature field from the JSON payload. Alternatively, there should be a clear mechanism (e.g., an omitempty option or a dedicated method) to prevent sending the parameter when it is unsupported by the model.

Actual Behavior

The request payload always includes a temperature field (even if set to zero by default), which leads to a 400 error for models that do not support this parameter (such as o1 and o3-mini).

Environment

  • OpenAI Go SDK version: v0.1.0-alpha.55
  • Go version: 1.23
  • Models affected: o1, o3-mini

Request

I kindly request that the library either:

  1. Adjust the serialization of BetaAssistantUpdateParams to omit the temperature field when it is not explicitly set (for example, by adding omitempty to the JSON tag), or
  2. Provide an alternative method or configuration that prevents sending unsupported parameters for models that do not accept them.

Thank you for your consideration and for maintaining the SDK.

@jacobzim-stl
Copy link
Collaborator

Thanks for the detailed report, I'll do some investigating.

@jacobzim-stl jacobzim-stl added the bug Something isn't working label Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants