pendra 0.19.0 → 0.20.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/README.md CHANGED
@@ -138,7 +138,7 @@ Embeddings, reranking, image generation, transcriptions and speech carry the
138
138
  same field:
139
139
 
140
140
  ```typescript
141
- const embeddings = await client.embeddings.create({ model: 'nomic-embed-text:latest', input: 'hi' });
141
+ const embeddings = await client.embeddings.create({ model: 'embeddinggemma:300m', input: 'hi' });
142
142
  console.log(embeddings.pendra?.worker?.id);
143
143
  ```
144
144
 
package/dist/index.d.mts CHANGED
@@ -19,6 +19,10 @@ interface Usage {
19
19
  * on {@link ChatCompletion.pendra} as a `truncated_during_reasoning` notice.
20
20
  */
21
21
  completion_tokens_details?: CompletionTokensDetails | null;
22
+ /** Breakdown of `prompt_tokens`. */
23
+ prompt_tokens_details?: {
24
+ cached_tokens?: number;
25
+ } | null;
22
26
  }
23
27
  interface ChatCompletionMessageToolCall {
24
28
  /**
@@ -116,10 +120,11 @@ interface PendraNotice {
116
120
  message: string;
117
121
  }
118
122
  /**
119
- * Per-request performance for a streaming completion, on the last chunk before
120
- * `[DONE]`. Non-streaming replies get the same figures in the `Server-Timing`
121
- * response header instead — headers flush before the first token, so a stream
122
- * cannot use them.
123
+ * Per-request performance for a completion. A stream carries it on the last
124
+ * chunk before `[DONE]`. A non-streaming reply carries the same figures as
125
+ * `pendra.timing` in the response body, and also in the `Server-Timing` header,
126
+ * which a slow request may not get because its headers flush before the result
127
+ * exists.
123
128
  *
124
129
  * Every field is present only when it was measured, and the whole block is
125
130
  * omitted when nothing was (an older worker reports no timings at all).
@@ -142,6 +147,8 @@ interface PendraTiming {
142
147
  model_load_ms?: number;
143
148
  /** `true` when the model had to be loaded for this request. */
144
149
  cold_start?: boolean;
150
+ /** Share of draft tokens the model kept, 0-1. Present only when the request speculated. */
151
+ draft_acceptance_rate?: number;
145
152
  }
146
153
  /**
147
154
  * One web-tool step a model ran while answering — reported only when the
package/dist/index.d.ts CHANGED
@@ -19,6 +19,10 @@ interface Usage {
19
19
  * on {@link ChatCompletion.pendra} as a `truncated_during_reasoning` notice.
20
20
  */
21
21
  completion_tokens_details?: CompletionTokensDetails | null;
22
+ /** Breakdown of `prompt_tokens`. */
23
+ prompt_tokens_details?: {
24
+ cached_tokens?: number;
25
+ } | null;
22
26
  }
23
27
  interface ChatCompletionMessageToolCall {
24
28
  /**
@@ -116,10 +120,11 @@ interface PendraNotice {
116
120
  message: string;
117
121
  }
118
122
  /**
119
- * Per-request performance for a streaming completion, on the last chunk before
120
- * `[DONE]`. Non-streaming replies get the same figures in the `Server-Timing`
121
- * response header instead — headers flush before the first token, so a stream
122
- * cannot use them.
123
+ * Per-request performance for a completion. A stream carries it on the last
124
+ * chunk before `[DONE]`. A non-streaming reply carries the same figures as
125
+ * `pendra.timing` in the response body, and also in the `Server-Timing` header,
126
+ * which a slow request may not get because its headers flush before the result
127
+ * exists.
123
128
  *
124
129
  * Every field is present only when it was measured, and the whole block is
125
130
  * omitted when nothing was (an older worker reports no timings at all).
@@ -142,6 +147,8 @@ interface PendraTiming {
142
147
  model_load_ms?: number;
143
148
  /** `true` when the model had to be loaded for this request. */
144
149
  cold_start?: boolean;
150
+ /** Share of draft tokens the model kept, 0-1. Present only when the request speculated. */
151
+ draft_acceptance_rate?: number;
145
152
  }
146
153
  /**
147
154
  * One web-tool step a model ran while answering — reported only when the
package/dist/index.js CHANGED
@@ -1957,7 +1957,7 @@ var Rerank = class {
1957
1957
  };
1958
1958
 
1959
1959
  // src/version.ts
1960
- var VERSION = "0.19.0";
1960
+ var VERSION = "0.20.0";
1961
1961
  var USER_AGENT = `pendra-node/${VERSION}`;
1962
1962
 
1963
1963
  // src/client.ts