@@ -28,6 +28,16 @@ type Run struct {
28
28
Metadata map [string ]any `json:"metadata"`
29
29
Usage Usage `json:"usage,omitempty"`
30
30
31
+ Temperature * float32 `json:"temperature,omitempty"`
32
+ // The maximum number of prompt tokens that may be used over the course of the run.
33
+ // If the run exceeds the number of prompt tokens specified, the run will end with status 'complete'.
34
+ MaxPromptTokens int `json:"max_prompt_tokens,omitempty"`
35
+ // The maximum number of completion tokens that may be used over the course of the run.
36
+ // If the run exceeds the number of completion tokens specified, the run will end with status 'complete'.
37
+ MaxCompletionTokens int `json:"max_completion_tokens,omitempty"`
38
+ // ThreadTruncationStrategy defines the truncation strategy to use for the thread.
39
+ TruncationStrategy * ThreadTruncationStrategy `json:"truncation_strategy,omitempty"`
40
+
31
41
httpHeader
32
42
}
33
43
@@ -78,8 +88,42 @@ type RunRequest struct {
78
88
AdditionalInstructions string `json:"additional_instructions,omitempty"`
79
89
Tools []Tool `json:"tools,omitempty"`
80
90
Metadata map [string ]any `json:"metadata,omitempty"`
91
+
92
+ // Sampling temperature between 0 and 2. Higher values like 0.8 are more random.
93
+ // lower values are more focused and deterministic.
94
+ Temperature * float32 `json:"temperature,omitempty"`
95
+
96
+ // The maximum number of prompt tokens that may be used over the course of the run.
97
+ // If the run exceeds the number of prompt tokens specified, the run will end with status 'complete'.
98
+ MaxPromptTokens int `json:"max_prompt_tokens,omitempty"`
99
+
100
+ // The maximum number of completion tokens that may be used over the course of the run.
101
+ // If the run exceeds the number of completion tokens specified, the run will end with status 'complete'.
102
+ MaxCompletionTokens int `json:"max_completion_tokens,omitempty"`
103
+
104
+ // ThreadTruncationStrategy defines the truncation strategy to use for the thread.
105
+ TruncationStrategy * ThreadTruncationStrategy `json:"truncation_strategy,omitempty"`
81
106
}
82
107
108
+ // ThreadTruncationStrategy defines the truncation strategy to use for the thread.
109
+ // https://platform.openai.com/docs/assistants/how-it-works/truncation-strategy.
110
+ type ThreadTruncationStrategy struct {
111
+ // default 'auto'.
112
+ Type TruncationStrategy `json:"type,omitempty"`
113
+ // this field should be set if the truncation strategy is set to LastMessages.
114
+ LastMessages * int `json:"last_messages,omitempty"`
115
+ }
116
+
117
+ // TruncationStrategy defines the existing truncation strategies existing for thread management in an assistant.
118
+ type TruncationStrategy string
119
+
120
+ const (
121
+ // TruncationStrategyAuto messages in the middle of the thread will be dropped to fit the context length of the model.
122
+ TruncationStrategyAuto = TruncationStrategy ("auto" )
123
+ // TruncationStrategyLastMessages the thread will be truncated to the n most recent messages in the thread.
124
+ TruncationStrategyLastMessages = TruncationStrategy ("last_messages" )
125
+ )
126
+
83
127
type RunModifyRequest struct {
84
128
Metadata map [string ]any `json:"metadata,omitempty"`
85
129
}
0 commit comments