pendra 0.21.1 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -87,10 +87,32 @@ interface ChatCompletionMessageParam {
87
87
  /** Alias of {@link ChatCompletionMessageParam.reasoning_content}; that one wins if both are set. */
88
88
  reasoning?: string | null;
89
89
  }
90
+ /** One candidate token at a position, and its log probability. */
91
+ interface TopLogprob {
92
+ token: string;
93
+ logprob: number;
94
+ /**
95
+ * The token's UTF-8 bytes. A token can hold part of a character, so join the
96
+ * bytes of consecutive tokens, not their text, to rebuild exact output.
97
+ */
98
+ bytes: number[] | null;
99
+ }
100
+ /** A token of the answer, its log probability and the likeliest alternatives. */
101
+ interface ChatCompletionTokenLogprob extends TopLogprob {
102
+ /** Empty unless `top_logprobs` was set. */
103
+ top_logprobs: TopLogprob[];
104
+ }
105
+ /** Log probabilities of a choice's answer tokens, present when `logprobs` is on. */
106
+ interface ChoiceLogprobs {
107
+ content: ChatCompletionTokenLogprob[] | null;
108
+ refusal: ChatCompletionTokenLogprob[] | null;
109
+ }
90
110
  interface Choice {
91
111
  index: number;
92
112
  message: ChatCompletionMessage;
93
113
  finish_reason: string | null;
114
+ /** Present when the request set `logprobs: true`. */
115
+ logprobs?: ChoiceLogprobs | null;
94
116
  }
95
117
  /**
96
118
  * A machine-readable advisory about how a completion was produced. `code` is a
@@ -249,6 +271,8 @@ interface StreamChoice {
249
271
  index: number;
250
272
  delta: ChoiceDelta;
251
273
  finish_reason: string | null;
274
+ /** The log probabilities of this chunk's content tokens, when `logprobs` is on. */
275
+ logprobs?: ChoiceLogprobs | null;
252
276
  }
253
277
  interface ChatCompletionChunk {
254
278
  id: string;
@@ -340,9 +364,9 @@ interface ChatCompletionCreateParams {
340
364
  reasoning_effort?: "none" | "minimal" | "low" | "medium" | "high" | (string & {}) | null;
341
365
  /** Bias specific tokens, keyed by token id (-100 to 100). */
342
366
  logit_bias?: Record<string, number> | null;
343
- /** Return log-probabilities for the chosen tokens (model permitting). */
367
+ /** Return the log probability of each answer token. */
344
368
  logprobs?: boolean | null;
345
- /** How many alternatives to report per position when `logprobs` is on. */
369
+ /** How many likely alternatives (0-20) to report per token. Needs `logprobs: true`. */
346
370
  top_logprobs?: number | null;
347
371
  /** OpenAI's newer spelling of `max_tokens`. */
348
372
  max_completion_tokens?: number | null;
@@ -1063,4 +1087,4 @@ declare class APIStreamError extends APIError {
1063
1087
  }
1064
1088
 
1065
1089
  export { APIConnectionError, APIError, APIResponseValidationError, APIStatusError, APIStreamError, AuthenticationError, Pendra, PrivateInferenceError, RateLimitError, Stream, Pendra as default };
1066
- export type { APIStatusErrorOptions, AudioFileInput, ChatCompletion, ChatCompletionChunk, ChatCompletionContentPart, ChatCompletionCreateParams, ChatCompletionMessage, ChatCompletionMessageParam, ChatCompletionMessageToolCall, Choice, ChoiceDelta, CompletionTokensDetails, CreateEmbeddingResponse, Embedding, EmbeddingCreateParams, EmbeddingUsage, ImageData, ImageGenerationCreateParams, ImageResponse, Model, ModerationCreateParams, ModerationImageURLInput, ModerationInput, ModerationInputPart, ModerationResponse, ModerationResult, ModerationTextInput, PendraExtension, PendraNotice, PendraOptions, PendraTiming, PendraWebToolStep, PendraWorker, RerankCreateParams, RerankResponse, RerankResult, RerankResultDocument, SpeechCreateParams, SpeechResponse, StreamChoice, TranscriptionCreateParams, TranscriptionResponse, TranscriptionSegment, Usage };
1090
+ export type { APIStatusErrorOptions, AudioFileInput, ChatCompletion, ChatCompletionChunk, ChatCompletionContentPart, ChatCompletionCreateParams, ChatCompletionMessage, ChatCompletionMessageParam, ChatCompletionMessageToolCall, ChatCompletionTokenLogprob, Choice, ChoiceDelta, ChoiceLogprobs, CompletionTokensDetails, CreateEmbeddingResponse, Embedding, EmbeddingCreateParams, EmbeddingUsage, ImageData, ImageGenerationCreateParams, ImageResponse, Model, ModerationCreateParams, ModerationImageURLInput, ModerationInput, ModerationInputPart, ModerationResponse, ModerationResult, ModerationTextInput, PendraExtension, PendraNotice, PendraOptions, PendraTiming, PendraWebToolStep, PendraWorker, RerankCreateParams, RerankResponse, RerankResult, RerankResultDocument, SpeechCreateParams, SpeechResponse, StreamChoice, TopLogprob, TranscriptionCreateParams, TranscriptionResponse, TranscriptionSegment, Usage };
package/dist/index.d.ts CHANGED
@@ -87,10 +87,32 @@ interface ChatCompletionMessageParam {
87
87
  /** Alias of {@link ChatCompletionMessageParam.reasoning_content}; that one wins if both are set. */
88
88
  reasoning?: string | null;
89
89
  }
90
+ /** One candidate token at a position, and its log probability. */
91
+ interface TopLogprob {
92
+ token: string;
93
+ logprob: number;
94
+ /**
95
+ * The token's UTF-8 bytes. A token can hold part of a character, so join the
96
+ * bytes of consecutive tokens, not their text, to rebuild exact output.
97
+ */
98
+ bytes: number[] | null;
99
+ }
100
+ /** A token of the answer, its log probability and the likeliest alternatives. */
101
+ interface ChatCompletionTokenLogprob extends TopLogprob {
102
+ /** Empty unless `top_logprobs` was set. */
103
+ top_logprobs: TopLogprob[];
104
+ }
105
+ /** Log probabilities of a choice's answer tokens, present when `logprobs` is on. */
106
+ interface ChoiceLogprobs {
107
+ content: ChatCompletionTokenLogprob[] | null;
108
+ refusal: ChatCompletionTokenLogprob[] | null;
109
+ }
90
110
  interface Choice {
91
111
  index: number;
92
112
  message: ChatCompletionMessage;
93
113
  finish_reason: string | null;
114
+ /** Present when the request set `logprobs: true`. */
115
+ logprobs?: ChoiceLogprobs | null;
94
116
  }
95
117
  /**
96
118
  * A machine-readable advisory about how a completion was produced. `code` is a
@@ -249,6 +271,8 @@ interface StreamChoice {
249
271
  index: number;
250
272
  delta: ChoiceDelta;
251
273
  finish_reason: string | null;
274
+ /** The log probabilities of this chunk's content tokens, when `logprobs` is on. */
275
+ logprobs?: ChoiceLogprobs | null;
252
276
  }
253
277
  interface ChatCompletionChunk {
254
278
  id: string;
@@ -340,9 +364,9 @@ interface ChatCompletionCreateParams {
340
364
  reasoning_effort?: "none" | "minimal" | "low" | "medium" | "high" | (string & {}) | null;
341
365
  /** Bias specific tokens, keyed by token id (-100 to 100). */
342
366
  logit_bias?: Record<string, number> | null;
343
- /** Return log-probabilities for the chosen tokens (model permitting). */
367
+ /** Return the log probability of each answer token. */
344
368
  logprobs?: boolean | null;
345
- /** How many alternatives to report per position when `logprobs` is on. */
369
+ /** How many likely alternatives (0-20) to report per token. Needs `logprobs: true`. */
346
370
  top_logprobs?: number | null;
347
371
  /** OpenAI's newer spelling of `max_tokens`. */
348
372
  max_completion_tokens?: number | null;
@@ -1063,4 +1087,4 @@ declare class APIStreamError extends APIError {
1063
1087
  }
1064
1088
 
1065
1089
  export { APIConnectionError, APIError, APIResponseValidationError, APIStatusError, APIStreamError, AuthenticationError, Pendra, PrivateInferenceError, RateLimitError, Stream, Pendra as default };
1066
- export type { APIStatusErrorOptions, AudioFileInput, ChatCompletion, ChatCompletionChunk, ChatCompletionContentPart, ChatCompletionCreateParams, ChatCompletionMessage, ChatCompletionMessageParam, ChatCompletionMessageToolCall, Choice, ChoiceDelta, CompletionTokensDetails, CreateEmbeddingResponse, Embedding, EmbeddingCreateParams, EmbeddingUsage, ImageData, ImageGenerationCreateParams, ImageResponse, Model, ModerationCreateParams, ModerationImageURLInput, ModerationInput, ModerationInputPart, ModerationResponse, ModerationResult, ModerationTextInput, PendraExtension, PendraNotice, PendraOptions, PendraTiming, PendraWebToolStep, PendraWorker, RerankCreateParams, RerankResponse, RerankResult, RerankResultDocument, SpeechCreateParams, SpeechResponse, StreamChoice, TranscriptionCreateParams, TranscriptionResponse, TranscriptionSegment, Usage };
1090
+ export type { APIStatusErrorOptions, AudioFileInput, ChatCompletion, ChatCompletionChunk, ChatCompletionContentPart, ChatCompletionCreateParams, ChatCompletionMessage, ChatCompletionMessageParam, ChatCompletionMessageToolCall, ChatCompletionTokenLogprob, Choice, ChoiceDelta, ChoiceLogprobs, CompletionTokensDetails, CreateEmbeddingResponse, Embedding, EmbeddingCreateParams, EmbeddingUsage, ImageData, ImageGenerationCreateParams, ImageResponse, Model, ModerationCreateParams, ModerationImageURLInput, ModerationInput, ModerationInputPart, ModerationResponse, ModerationResult, ModerationTextInput, PendraExtension, PendraNotice, PendraOptions, PendraTiming, PendraWebToolStep, PendraWorker, RerankCreateParams, RerankResponse, RerankResult, RerankResultDocument, SpeechCreateParams, SpeechResponse, StreamChoice, TopLogprob, TranscriptionCreateParams, TranscriptionResponse, TranscriptionSegment, Usage };
package/dist/index.js CHANGED
@@ -2033,7 +2033,7 @@ var Rerank = class {
2033
2033
  };
2034
2034
 
2035
2035
  // src/version.ts
2036
- var VERSION = "0.21.1";
2036
+ var VERSION = "0.22.0";
2037
2037
  var USER_AGENT = `pendra-node/${VERSION}`;
2038
2038
 
2039
2039
  // src/client.ts