hoomanjs 1.26.2 → 1.26.3
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
|
@@ -418,6 +418,8 @@ OpenAI-compatible gateways that put token `usage` on the last streamed chunk tog
|
|
|
418
418
|
|
|
419
419
|
Use for a [TensorZero](https://tensorzero.com) gateway’s **OpenAI-compatible** HTTP API (for example `/openai/v1`). Same general `params` shape as **OpenAI** (`apiKey`, `clientConfig.baseURL`, etc.), but implemented with **StrandsTensorZeroModel** so gateway-specific streaming works end-to-end: reasoning carried in `tensorzero_extra_content` shows as thinking in the chat UI, and usage metadata is normalized.
|
|
420
420
|
|
|
421
|
+
Gateway features such as **tag-scoped rate limits** use TensorZero tags on each request. Set them in config under the nested `params` object (Strands forwards that object onto the Chat Completions body), for example `tensorzero::tags.user_id`.
|
|
422
|
+
|
|
421
423
|
```json
|
|
422
424
|
{
|
|
423
425
|
"provider": "tensorzero",
|
|
@@ -426,6 +428,11 @@ Use for a [TensorZero](https://tensorzero.com) gateway’s **OpenAI-compatible**
|
|
|
426
428
|
"apiKey": "your-tensorzero-or-gateway-key",
|
|
427
429
|
"clientConfig": {
|
|
428
430
|
"baseURL": "http://localhost:3000/openai/v1"
|
|
431
|
+
},
|
|
432
|
+
"params": {
|
|
433
|
+
"tensorzero::tags": {
|
|
434
|
+
"user_id": "your-stable-user-or-tenant-id"
|
|
435
|
+
}
|
|
429
436
|
}
|
|
430
437
|
}
|
|
431
438
|
}
|
|
@@ -5,5 +5,8 @@ export type TensorZeroModelConfig = Omit<OpenAIModelOptions, "api" | "modelId">;
|
|
|
5
5
|
/**
|
|
6
6
|
* Strands {@link Model} for a TensorZero gateway’s OpenAI-compatible HTTP API (`/openai/v1`).
|
|
7
7
|
* Handles gateway-specific streaming: token usage on the last chunk and `tensorzero_extra_content` thoughts.
|
|
8
|
+
*
|
|
9
|
+
* Set TensorZero tags (e.g. `user_id` for gateway rate limits) in config under `llm.params.params`:
|
|
10
|
+
* `"params": { "tensorzero::tags": { "user_id": "…" } }` alongside `apiKey` / `clientConfig`.
|
|
8
11
|
*/
|
|
9
12
|
export declare function create(model: string, params: Record<string, unknown>): StrandsTensorZeroModel;
|
|
@@ -3,6 +3,9 @@ export { StrandsTensorZeroModel } from "./strands-tensorzero.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Strands {@link Model} for a TensorZero gateway’s OpenAI-compatible HTTP API (`/openai/v1`).
|
|
5
5
|
* Handles gateway-specific streaming: token usage on the last chunk and `tensorzero_extra_content` thoughts.
|
|
6
|
+
*
|
|
7
|
+
* Set TensorZero tags (e.g. `user_id` for gateway rate limits) in config under `llm.params.params`:
|
|
8
|
+
* `"params": { "tensorzero::tags": { "user_id": "…" } }` alongside `apiKey` / `clientConfig`.
|
|
6
9
|
*/
|
|
7
10
|
export function create(model, params) {
|
|
8
11
|
return new StrandsTensorZeroModel({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/models/tensorzero/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAIjE
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/models/tensorzero/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAIjE;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CACpB,KAAa,EACb,MAA+B;IAE/B,OAAO,IAAI,sBAAsB,CAAC;QAChC,GAAG,EAAE,MAAM;QACX,OAAO,EAAE,KAAK;QACd,GAAI,MAAgC;KACrC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -173,7 +173,7 @@ Provider notes (these refer to fields inside `options.params` unless noted):
|
|
|
173
173
|
- `moonshot`: `params.apiKey`, `baseURL`, `headers`, and `fetch` configure the provider. Other keys are forwarded as Vercel model config.
|
|
174
174
|
- `xai`: `params.apiKey`, `baseURL`, and `headers` configure the provider. Other keys are forwarded as Vercel model config.
|
|
175
175
|
- `openai`: Strands **OpenAIModel** (Chat Completions). `params.apiKey` (or env `OPENAI_API_KEY`), optional `clientConfig` (e.g. `baseURL` for an OpenAI-compatible HTTP API). `model` becomes `modelId`. Streaming usage from some gateways is normalized automatically. For a **TensorZero** gateway, prefer **`tensorzero`** if you want reasoning/thinking streamed into the UI and consistent usage metadata.
|
|
176
|
-
- `tensorzero`: Same Chat Completions shape as `openai`, but **`StrandsTensorZeroModel`** — use for a [TensorZero](https://tensorzero.com) gateway’s OpenAI-compatible route (e.g. `clientConfig.baseURL` like `http://localhost:3000/openai/v1`). Maps gateway `tensorzero_extra_content` thoughts to Strands reasoning deltas and normalizes final-chunk usage. `model` is typically `tensorzero::function_name::<name>` (or other TensorZero model id strings the gateway accepts).
|
|
176
|
+
- `tensorzero`: Same Chat Completions shape as `openai`, but **`StrandsTensorZeroModel`** — use for a [TensorZero](https://tensorzero.com) gateway’s OpenAI-compatible route (e.g. `clientConfig.baseURL` like `http://localhost:3000/openai/v1`). Maps gateway `tensorzero_extra_content` thoughts to Strands reasoning deltas and normalizes final-chunk usage. `model` is typically `tensorzero::function_name::<name>` (or other TensorZero model id strings the gateway accepts). For gateway tag-based rate limits, set `params.params["tensorzero::tags"]` (e.g. `user_id`) in the model entry in config.
|
|
177
177
|
- `ollama`: `params.host`, `keepAlive`, `options`, and `think` configure the Ollama wrapper. `think` may be `true`, `false`, `"high"`, `"medium"`, or `"low"`.
|
|
178
178
|
- `bedrock`: `params.region`, `clientConfig`, and optional `apiKey` configure Bedrock access. Put AWS credentials under `params.clientConfig.credentials` with `accessKeyId`, `secretAccessKey`, and optional `sessionToken`; put an AWS CLI/shared-config profile name in `params.clientConfig.profile`. If credentials and profile are omitted, Bedrock uses the AWS SDK default credential chain, including environment variables and AWS CLI/shared credentials. Other keys are forwarded as Bedrock model options, such as `temperature`, `maxTokens`, `stream`, and `cacheConfig`.
|
|
179
179
|
|