Skip to content

Commit d8ed245

Browse files
fix(client): cast to raw message when converting to params
1 parent 5df5ea9 commit d8ed245

File tree

9 files changed

+58
-57
lines changed

9 files changed

+58
-57
lines changed

betaassistant.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@ func (r *AssistantToolUnion) UnmarshalJSON(data []byte) error {
14071407
// be used at the last possible moment before sending a request. Test for this with
14081408
// AssistantToolUnionParam.Overrides()
14091409
func (r AssistantToolUnion) ToParam() AssistantToolUnionParam {
1410-
return param.Override[AssistantToolUnionParam](r.RawJSON())
1410+
return param.Override[AssistantToolUnionParam](json.RawMessage(r.RawJSON()))
14111411
}
14121412

14131413
func AssistantToolParamOfFunction(function shared.FunctionDefinitionParam) AssistantToolUnionParam {
@@ -1504,7 +1504,7 @@ func (r *CodeInterpreterTool) UnmarshalJSON(data []byte) error {
15041504
// be used at the last possible moment before sending a request. Test for this with
15051505
// CodeInterpreterToolParam.Overrides()
15061506
func (r CodeInterpreterTool) ToParam() CodeInterpreterToolParam {
1507-
return param.Override[CodeInterpreterToolParam](r.RawJSON())
1507+
return param.Override[CodeInterpreterToolParam](json.RawMessage(r.RawJSON()))
15081508
}
15091509

15101510
func NewCodeInterpreterToolParam() CodeInterpreterToolParam {
@@ -1555,7 +1555,7 @@ func (r *FileSearchTool) UnmarshalJSON(data []byte) error {
15551555
// be used at the last possible moment before sending a request. Test for this with
15561556
// FileSearchToolParam.Overrides()
15571557
func (r FileSearchTool) ToParam() FileSearchToolParam {
1558-
return param.Override[FileSearchToolParam](r.RawJSON())
1558+
return param.Override[FileSearchToolParam](json.RawMessage(r.RawJSON()))
15591559
}
15601560

15611561
// Overrides for the file search tool.
@@ -1728,7 +1728,7 @@ func (r *FunctionTool) UnmarshalJSON(data []byte) error {
17281728
// be used at the last possible moment before sending a request. Test for this with
17291729
// FunctionToolParam.Overrides()
17301730
func (r FunctionTool) ToParam() FunctionToolParam {
1731-
return param.Override[FunctionToolParam](r.RawJSON())
1731+
return param.Override[FunctionToolParam](json.RawMessage(r.RawJSON()))
17321732
}
17331733

17341734
// The properties Function, Type are required.

betathread.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func (r *AssistantResponseFormatOptionUnion) UnmarshalJSON(data []byte) error {
185185
// be used at the last possible moment before sending a request. Test for this with
186186
// AssistantResponseFormatOptionUnionParam.Overrides()
187187
func (r AssistantResponseFormatOptionUnion) ToParam() AssistantResponseFormatOptionUnionParam {
188-
return param.Override[AssistantResponseFormatOptionUnionParam](r.RawJSON())
188+
return param.Override[AssistantResponseFormatOptionUnionParam](json.RawMessage(r.RawJSON()))
189189
}
190190

191191
func AssistantResponseFormatOptionParamOfAuto() AssistantResponseFormatOptionUnionParam {
@@ -279,7 +279,7 @@ func (r *AssistantToolChoice) UnmarshalJSON(data []byte) error {
279279
// be used at the last possible moment before sending a request. Test for this with
280280
// AssistantToolChoiceParam.Overrides()
281281
func (r AssistantToolChoice) ToParam() AssistantToolChoiceParam {
282-
return param.Override[AssistantToolChoiceParam](r.RawJSON())
282+
return param.Override[AssistantToolChoiceParam](json.RawMessage(r.RawJSON()))
283283
}
284284

285285
// The type of the tool. If type is `function`, the function name must be set
@@ -336,7 +336,7 @@ func (r *AssistantToolChoiceFunction) UnmarshalJSON(data []byte) error {
336336
// be used at the last possible moment before sending a request. Test for this with
337337
// AssistantToolChoiceFunctionParam.Overrides()
338338
func (r AssistantToolChoiceFunction) ToParam() AssistantToolChoiceFunctionParam {
339-
return param.Override[AssistantToolChoiceFunctionParam](r.RawJSON())
339+
return param.Override[AssistantToolChoiceFunctionParam](json.RawMessage(r.RawJSON()))
340340
}
341341

342342
// The property Name is required.
@@ -400,7 +400,7 @@ func (r *AssistantToolChoiceOptionUnion) UnmarshalJSON(data []byte) error {
400400
// be used at the last possible moment before sending a request. Test for this with
401401
// AssistantToolChoiceOptionUnionParam.Overrides()
402402
func (r AssistantToolChoiceOptionUnion) ToParam() AssistantToolChoiceOptionUnionParam {
403-
return param.Override[AssistantToolChoiceOptionUnionParam](r.RawJSON())
403+
return param.Override[AssistantToolChoiceOptionUnionParam](json.RawMessage(r.RawJSON()))
404404
}
405405

406406
// `none` means the model will not call any tools and instead generates a message.

betathreadmessage.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ func (r *ImageFile) UnmarshalJSON(data []byte) error {
511511
// be used at the last possible moment before sending a request. Test for this with
512512
// ImageFileParam.Overrides()
513513
func (r ImageFile) ToParam() ImageFileParam {
514-
return param.Override[ImageFileParam](r.RawJSON())
514+
return param.Override[ImageFileParam](json.RawMessage(r.RawJSON()))
515515
}
516516

517517
// Specifies the detail level of the image if specified by the user. `low` uses
@@ -573,7 +573,7 @@ func (r *ImageFileContentBlock) UnmarshalJSON(data []byte) error {
573573
// be used at the last possible moment before sending a request. Test for this with
574574
// ImageFileContentBlockParam.Overrides()
575575
func (r ImageFileContentBlock) ToParam() ImageFileContentBlockParam {
576-
return param.Override[ImageFileContentBlockParam](r.RawJSON())
576+
return param.Override[ImageFileContentBlockParam](json.RawMessage(r.RawJSON()))
577577
}
578578

579579
// References an image [File](https://platform.openai.com/docs/api-reference/files)
@@ -686,7 +686,7 @@ func (r *ImageURL) UnmarshalJSON(data []byte) error {
686686
// be used at the last possible moment before sending a request. Test for this with
687687
// ImageURLParam.Overrides()
688688
func (r ImageURL) ToParam() ImageURLParam {
689-
return param.Override[ImageURLParam](r.RawJSON())
689+
return param.Override[ImageURLParam](json.RawMessage(r.RawJSON()))
690690
}
691691

692692
// Specifies the detail level of the image. `low` uses fewer tokens, you can opt in
@@ -746,7 +746,7 @@ func (r *ImageURLContentBlock) UnmarshalJSON(data []byte) error {
746746
// be used at the last possible moment before sending a request. Test for this with
747747
// ImageURLContentBlockParam.Overrides()
748748
func (r ImageURLContentBlock) ToParam() ImageURLContentBlockParam {
749-
return param.Override[ImageURLContentBlockParam](r.RawJSON())
749+
return param.Override[ImageURLContentBlockParam](json.RawMessage(r.RawJSON()))
750750
}
751751

752752
// References an image URL in the content of a message.

chatcompletion.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package openai
44

55
import (
66
"context"
7+
"encoding/json"
78
"errors"
89
"fmt"
910
"net/http"
@@ -1620,7 +1621,7 @@ func (r *ChatCompletionMessageToolCall) UnmarshalJSON(data []byte) error {
16201621
// be used at the last possible moment before sending a request. Test for this with
16211622
// ChatCompletionMessageToolCallParam.Overrides()
16221623
func (r ChatCompletionMessageToolCall) ToParam() ChatCompletionMessageToolCallParam {
1623-
return param.Override[ChatCompletionMessageToolCallParam](r.RawJSON())
1624+
return param.Override[ChatCompletionMessageToolCallParam](json.RawMessage(r.RawJSON()))
16241625
}
16251626

16261627
// The function that the model called.

finetuningmethod.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (r *DpoHyperparametersResp) UnmarshalJSON(data []byte) error {
6868
// be used at the last possible moment before sending a request. Test for this with
6969
// DpoHyperparameters.Overrides()
7070
func (r DpoHyperparametersResp) ToParam() DpoHyperparameters {
71-
return param.Override[DpoHyperparameters](r.RawJSON())
71+
return param.Override[DpoHyperparameters](json.RawMessage(r.RawJSON()))
7272
}
7373

7474
// DpoHyperparametersBatchSizeUnionResp contains all possible properties and values
@@ -372,7 +372,7 @@ func (r *DpoMethod) UnmarshalJSON(data []byte) error {
372372
// be used at the last possible moment before sending a request. Test for this with
373373
// DpoMethodParam.Overrides()
374374
func (r DpoMethod) ToParam() DpoMethodParam {
375-
return param.Override[DpoMethodParam](r.RawJSON())
375+
return param.Override[DpoMethodParam](json.RawMessage(r.RawJSON()))
376376
}
377377

378378
// Configuration for the DPO fine-tuning method.
@@ -438,7 +438,7 @@ func (r *ReinforcementHyperparametersResp) UnmarshalJSON(data []byte) error {
438438
// be used at the last possible moment before sending a request. Test for this with
439439
// ReinforcementHyperparameters.Overrides()
440440
func (r ReinforcementHyperparametersResp) ToParam() ReinforcementHyperparameters {
441-
return param.Override[ReinforcementHyperparameters](r.RawJSON())
441+
return param.Override[ReinforcementHyperparameters](json.RawMessage(r.RawJSON()))
442442
}
443443

444444
// ReinforcementHyperparametersBatchSizeUnionResp contains all possible properties
@@ -890,7 +890,7 @@ func (r *ReinforcementMethod) UnmarshalJSON(data []byte) error {
890890
// be used at the last possible moment before sending a request. Test for this with
891891
// ReinforcementMethodParam.Overrides()
892892
func (r ReinforcementMethod) ToParam() ReinforcementMethodParam {
893-
return param.Override[ReinforcementMethodParam](r.RawJSON())
893+
return param.Override[ReinforcementMethodParam](json.RawMessage(r.RawJSON()))
894894
}
895895

896896
// ReinforcementMethodGraderUnion contains all possible properties and values from
@@ -1230,7 +1230,7 @@ func (r *SupervisedHyperparametersResp) UnmarshalJSON(data []byte) error {
12301230
// be used at the last possible moment before sending a request. Test for this with
12311231
// SupervisedHyperparameters.Overrides()
12321232
func (r SupervisedHyperparametersResp) ToParam() SupervisedHyperparameters {
1233-
return param.Override[SupervisedHyperparameters](r.RawJSON())
1233+
return param.Override[SupervisedHyperparameters](json.RawMessage(r.RawJSON()))
12341234
}
12351235

12361236
// SupervisedHyperparametersBatchSizeUnionResp contains all possible properties and
@@ -1468,7 +1468,7 @@ func (r *SupervisedMethod) UnmarshalJSON(data []byte) error {
14681468
// be used at the last possible moment before sending a request. Test for this with
14691469
// SupervisedMethodParam.Overrides()
14701470
func (r SupervisedMethod) ToParam() SupervisedMethodParam {
1471-
return param.Override[SupervisedMethodParam](r.RawJSON())
1471+
return param.Override[SupervisedMethodParam](json.RawMessage(r.RawJSON()))
14721472
}
14731473

14741474
// Configuration for the supervised fine-tuning method.

gradergradermodel.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func (r *LabelModelGrader) UnmarshalJSON(data []byte) error {
7171
// be used at the last possible moment before sending a request. Test for this with
7272
// LabelModelGraderParam.Overrides()
7373
func (r LabelModelGrader) ToParam() LabelModelGraderParam {
74-
return param.Override[LabelModelGraderParam](r.RawJSON())
74+
return param.Override[LabelModelGraderParam](json.RawMessage(r.RawJSON()))
7575
}
7676

7777
// A message input to the model with a role indicating instruction following
@@ -343,7 +343,7 @@ func (r *MultiGrader) UnmarshalJSON(data []byte) error {
343343
// be used at the last possible moment before sending a request. Test for this with
344344
// MultiGraderParam.Overrides()
345345
func (r MultiGrader) ToParam() MultiGraderParam {
346-
return param.Override[MultiGraderParam](r.RawJSON())
346+
return param.Override[MultiGraderParam](json.RawMessage(r.RawJSON()))
347347
}
348348

349349
// MultiGraderGradersUnion contains all possible properties and values from
@@ -701,7 +701,7 @@ func (r *PythonGrader) UnmarshalJSON(data []byte) error {
701701
// be used at the last possible moment before sending a request. Test for this with
702702
// PythonGraderParam.Overrides()
703703
func (r PythonGrader) ToParam() PythonGraderParam {
704-
return param.Override[PythonGraderParam](r.RawJSON())
704+
return param.Override[PythonGraderParam](json.RawMessage(r.RawJSON()))
705705
}
706706

707707
// A PythonGrader object that runs a python script on the input.
@@ -768,7 +768,7 @@ func (r *ScoreModelGrader) UnmarshalJSON(data []byte) error {
768768
// be used at the last possible moment before sending a request. Test for this with
769769
// ScoreModelGraderParam.Overrides()
770770
func (r ScoreModelGrader) ToParam() ScoreModelGraderParam {
771-
return param.Override[ScoreModelGraderParam](r.RawJSON())
771+
return param.Override[ScoreModelGraderParam](json.RawMessage(r.RawJSON()))
772772
}
773773

774774
// A message input to the model with a role indicating instruction following
@@ -1044,7 +1044,7 @@ func (r *StringCheckGrader) UnmarshalJSON(data []byte) error {
10441044
// be used at the last possible moment before sending a request. Test for this with
10451045
// StringCheckGraderParam.Overrides()
10461046
func (r StringCheckGrader) ToParam() StringCheckGraderParam {
1047-
return param.Override[StringCheckGraderParam](r.RawJSON())
1047+
return param.Override[StringCheckGraderParam](json.RawMessage(r.RawJSON()))
10481048
}
10491049

10501050
// The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`.
@@ -1127,7 +1127,7 @@ func (r *TextSimilarityGrader) UnmarshalJSON(data []byte) error {
11271127
// be used at the last possible moment before sending a request. Test for this with
11281128
// TextSimilarityGraderParam.Overrides()
11291129
func (r TextSimilarityGrader) ToParam() TextSimilarityGraderParam {
1130-
return param.Override[TextSimilarityGraderParam](r.RawJSON())
1130+
return param.Override[TextSimilarityGraderParam](json.RawMessage(r.RawJSON()))
11311131
}
11321132

11331133
// The evaluation metric to use. One of `fuzzy_match`, `bleu`, `gleu`, `meteor`,

0 commit comments

Comments
 (0)