Skip to content

Commit 01f0ba8

Browse files
feat: Implement include parameter specifically for adding logprobs in the output message
1 parent c810c19 commit 01f0ba8

File tree

9 files changed

+764
-110
lines changed

9 files changed

+764
-110
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 103
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-798a94e418defb2b9c8e7432a9f8a76635439b07e8fd3cc4a158a2b26dd60b90.yml
3-
openapi_spec_hash: 93b1520629590a9ecaa74d726c006a49
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-4cdfb92312df3e349a702847ffb5a464d108247790eec659fb4597712ca37653.yml
3+
openapi_spec_hash: 0888e1be36cd34c77dd131dc8cc21765
44
config_hash: 39578cfdeb4a10121f2cb3fa3e4d5e20

src/resources/chat/chat.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ export namespace ChatCompletionChunk {
132132

133133
logprob: number;
134134

135-
top_logprobs: Array<Content.TopLogprob>;
136-
137135
bytes?: Array<number> | null;
136+
137+
top_logprobs?: Array<Content.TopLogprob> | null;
138138
}
139139

140140
export namespace Content {
@@ -166,9 +166,9 @@ export namespace ChatCompletionChunk {
166166

167167
logprob: number;
168168

169-
top_logprobs: Array<Refusal.TopLogprob>;
170-
171169
bytes?: Array<number> | null;
170+
171+
top_logprobs?: Array<Refusal.TopLogprob> | null;
172172
}
173173

174174
export namespace Refusal {

src/resources/chat/completions.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,9 @@ export namespace CompletionCreateResponse {
326326

327327
logprob: number;
328328

329-
top_logprobs: Array<Content.TopLogprob>;
330-
331329
bytes?: Array<number> | null;
330+
331+
top_logprobs?: Array<Content.TopLogprob> | null;
332332
}
333333

334334
export namespace Content {
@@ -360,9 +360,9 @@ export namespace CompletionCreateResponse {
360360

361361
logprob: number;
362362

363-
top_logprobs: Array<Refusal.TopLogprob>;
364-
365363
bytes?: Array<number> | null;
364+
365+
top_logprobs?: Array<Refusal.TopLogprob> | null;
366366
}
367367

368368
export namespace Refusal {
@@ -686,9 +686,9 @@ export namespace CompletionRetrieveResponse {
686686

687687
logprob: number;
688688

689-
top_logprobs: Array<Content.TopLogprob>;
690-
691689
bytes?: Array<number> | null;
690+
691+
top_logprobs?: Array<Content.TopLogprob> | null;
692692
}
693693

694694
export namespace Content {
@@ -720,9 +720,9 @@ export namespace CompletionRetrieveResponse {
720720

721721
logprob: number;
722722

723-
top_logprobs: Array<Refusal.TopLogprob>;
724-
725723
bytes?: Array<number> | null;
724+
725+
top_logprobs?: Array<Refusal.TopLogprob> | null;
726726
}
727727

728728
export namespace Refusal {
@@ -1251,9 +1251,9 @@ export namespace CompletionListResponse {
12511251

12521252
logprob: number;
12531253

1254-
top_logprobs: Array<Content.TopLogprob>;
1255-
12561254
bytes?: Array<number> | null;
1255+
1256+
top_logprobs?: Array<Content.TopLogprob> | null;
12571257
}
12581258

12591259
export namespace Content {
@@ -1285,9 +1285,9 @@ export namespace CompletionListResponse {
12851285

12861286
logprob: number;
12871287

1288-
top_logprobs: Array<Refusal.TopLogprob>;
1289-
12901288
bytes?: Array<number> | null;
1289+
1290+
top_logprobs?: Array<Refusal.TopLogprob> | null;
12911291
}
12921292

12931293
export namespace Refusal {

src/resources/completions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ export namespace CompletionCreateResponse {
107107

108108
logprob: number;
109109

110-
top_logprobs: Array<Content.TopLogprob>;
111-
112110
bytes?: Array<number> | null;
111+
112+
top_logprobs?: Array<Content.TopLogprob> | null;
113113
}
114114

115115
export namespace Content {
@@ -141,9 +141,9 @@ export namespace CompletionCreateResponse {
141141

142142
logprob: number;
143143

144-
top_logprobs: Array<Refusal.TopLogprob>;
145-
146144
bytes?: Array<number> | null;
145+
146+
top_logprobs?: Array<Refusal.TopLogprob> | null;
147147
}
148148

149149
export namespace Refusal {

src/resources/conversations/conversations.ts

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export namespace ConversationCreateParams {
149149
| OpenAIResponseMessageInput.OpenAIResponseInputMessageContentFile
150150
>
151151
| Array<
152-
| OpenAIResponseMessageInput.OpenAIResponseOutputMessageContentOutputText
152+
| OpenAIResponseMessageInput.OpenAIResponseOutputMessageContentOutputTextInput
153153
| OpenAIResponseMessageInput.OpenAIResponseContentPartRefusal
154154
>;
155155

@@ -200,20 +200,22 @@ export namespace ConversationCreateParams {
200200
type?: 'input_file';
201201
}
202202

203-
export interface OpenAIResponseOutputMessageContentOutputText {
203+
export interface OpenAIResponseOutputMessageContentOutputTextInput {
204204
text: string;
205205

206206
annotations?: Array<
207-
| OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationFileCitation
208-
| OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationCitation
209-
| OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationContainerFileCitation
210-
| OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationFilePath
207+
| OpenAIResponseOutputMessageContentOutputTextInput.OpenAIResponseAnnotationFileCitation
208+
| OpenAIResponseOutputMessageContentOutputTextInput.OpenAIResponseAnnotationCitation
209+
| OpenAIResponseOutputMessageContentOutputTextInput.OpenAIResponseAnnotationContainerFileCitation
210+
| OpenAIResponseOutputMessageContentOutputTextInput.OpenAIResponseAnnotationFilePath
211211
>;
212212

213+
logprobs?: Array<OpenAIResponseOutputMessageContentOutputTextInput.Logprob> | null;
214+
213215
type?: 'output_text';
214216
}
215217

216-
export namespace OpenAIResponseOutputMessageContentOutputText {
218+
export namespace OpenAIResponseOutputMessageContentOutputTextInput {
217219
/**
218220
* File citation annotation for referencing specific files in response content.
219221
*/
@@ -263,6 +265,40 @@ export namespace ConversationCreateParams {
263265

264266
type?: 'file_path';
265267
}
268+
269+
/**
270+
* The log probability for a token from an OpenAI-compatible chat completion
271+
* response.
272+
*
273+
* :token: The token :bytes: (Optional) The bytes for the token :logprob: The log
274+
* probability of the token :top_logprobs: The top log probabilities for the token
275+
*/
276+
export interface Logprob {
277+
token: string;
278+
279+
logprob: number;
280+
281+
bytes?: Array<number> | null;
282+
283+
top_logprobs?: Array<Logprob.TopLogprob> | null;
284+
}
285+
286+
export namespace Logprob {
287+
/**
288+
* The top log probability for a token from an OpenAI-compatible chat completion
289+
* response.
290+
*
291+
* :token: The token :bytes: (Optional) The bytes for the token :logprob: The log
292+
* probability of the token
293+
*/
294+
export interface TopLogprob {
295+
token: string;
296+
297+
logprob: number;
298+
299+
bytes?: Array<number> | null;
300+
}
301+
}
266302
}
267303

268304
/**

0 commit comments

Comments
 (0)