Skip to content

Commit

Permalink
linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
skyscrapr committed Jun 2, 2024
1 parent 92774ce commit 40efee6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
19 changes: 5 additions & 14 deletions openai/assistant_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,7 @@ func (r *AssistantResource) Create(ctx context.Context, req resource.CreateReque
}

aReq.Tools = expandAssistantTools(toolModels)
aReq.ToolResources, diags = expandAssistantToolResources(ctx, data.ToolResources)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
}
aReq.ToolResources = expandAssistantToolResources(ctx, data.ToolResources)

assistant, err := r.client.Assistants().CreateAssistant(&aReq)
if err != nil {
Expand Down Expand Up @@ -258,11 +254,7 @@ func (r *AssistantResource) Update(ctx context.Context, req resource.UpdateReque
}

aReq.Tools = expandAssistantTools(toolModels)
aReq.ToolResources, diags = expandAssistantToolResources(ctx, data.ToolResources)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
}
aReq.ToolResources = expandAssistantToolResources(ctx, data.ToolResources)

assistant, err := r.client.Assistants().ModifyAssistant(state.Id.ValueString(), &aReq)
if err != nil {
Expand Down Expand Up @@ -344,10 +336,9 @@ func expandAssistantTools(tfList []OpenAIAssistantToolModel) []openai.AssistantT
return tools
}

func expandAssistantToolResources(ctx context.Context, model *OpenAIAssistantToolResourcesModel) (*openai.AssistantToolResources, diag.Diagnostics) {
var diags diag.Diagnostics
func expandAssistantToolResources(ctx context.Context, model *OpenAIAssistantToolResourcesModel) *openai.AssistantToolResources {
if model == nil {
return nil, nil
return nil
}
toolResources := &openai.AssistantToolResources{}
if !model.CodeInterpreter.IsNull() {
Expand All @@ -371,5 +362,5 @@ func expandAssistantToolResources(ctx context.Context, model *OpenAIAssistantToo
model.FileSearch.As(ctx, &fileSearch, basetypes.ObjectAsOptions{})
fileSearch.VectorStoreIDs.ElementsAs(ctx, &toolResources.FileSearch.VectorStoreIDs, false)
}
return toolResources, diags
return toolResources
}
2 changes: 0 additions & 2 deletions openai/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@ func NewOpenAIVectoreStoreModel(ctx context.Context, vs *openai.VectorStore, dat
return model, diags
}

// OpenAIFileCountsModel
type OpenAIFileCountsModel struct {
InProgress types.Int64 `tfsdk:"in_progress"`
Completed types.Int64 `tfsdk:"completed"`
Expand All @@ -461,7 +460,6 @@ func (e OpenAIFileCountsModel) AttrTypes() map[string]attr.Type {
}
}

// OpenAIExpiresAfterModel
type OpenAIExpiresAfterModel struct {
Anchor types.String `tfsdk:"anchor"`
Days types.Int64 `tfsdk:"days"`
Expand Down

0 comments on commit 40efee6

Please sign in to comment.