@jambonz/llm 0.3.3 → 0.4.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.
@@ -103,12 +103,35 @@ interface Usage {
103
103
  outputTokens?: number;
104
104
  totalTokens?: number;
105
105
  }
106
- type AuthSpec = ApiKeyAuth | BedrockIamAuth | BedrockApiKeyAuth | GoogleApiKeyAuth | GoogleServiceAccountAuth | VertexServiceAccountAuth;
106
+ type AuthSpec = ApiKeyAuth | AzureOpenAIApiKeyAuth | BedrockIamAuth | BedrockApiKeyAuth | GoogleApiKeyAuth | GoogleServiceAccountAuth | VertexServiceAccountAuth;
107
107
  interface ApiKeyAuth {
108
108
  kind: 'apiKey';
109
109
  apiKey: string;
110
110
  baseURL?: string;
111
111
  }
112
+ /**
113
+ * Azure OpenAI Service uses an OpenAI-compatible wire protocol but differs
114
+ * from `api.openai.com` in three important ways:
115
+ * 1. Auth header is `api-key: {key}` (not `Authorization: Bearer {key}`).
116
+ * 2. The URL embeds the deployment name, not the model id:
117
+ * `https://{endpoint}/openai/deployments/{deployment}/chat/completions?api-version={version}`.
118
+ * The `model` field on the request is ignored by Azure; the deployment in
119
+ * the URL determines which model runs. Capability flags in the manifest
120
+ * are keyed by the underlying model (gpt-4o, gpt-4o-mini, ...).
121
+ * 3. `apiVersion` is a user-supplied knob — Microsoft rolls versions
122
+ * frequently and customers shouldn't need a library release to move to a
123
+ * newer one.
124
+ */
125
+ interface AzureOpenAIApiKeyAuth {
126
+ kind: 'azureOpenAIApiKey';
127
+ apiKey: string;
128
+ /** Resource endpoint, e.g. `https://my-resource.openai.azure.com`. No trailing slash. */
129
+ endpoint: string;
130
+ /** Deployment name the user created in Azure AI Studio / Azure OpenAI Studio. */
131
+ deployment: string;
132
+ /** Azure OpenAI data-plane api-version, e.g. `2024-10-21`. */
133
+ apiVersion: string;
134
+ }
112
135
  interface BedrockIamAuth {
113
136
  kind: 'bedrockIam';
114
137
  accessKeyId: string;
@@ -318,4 +341,4 @@ interface CreateLlmArgs<A extends AuthSpec = AuthSpec> {
318
341
  client?: ClientOptions;
319
342
  }
320
343
 
321
- export type { AuthSpec as A, BedrockApiKeyAuth as B, CreateLlmArgs as C, FinishReason as F, GoogleApiKeyAuth as G, JsonSchema as J, LlmAdapter as L, Message as M, PromptRequest as P, Role as R, ServiceAccountJson as S, Tool as T, Usage as U, VertexServiceAccountAuth as V, AdapterFactory as a, AdapterManifest as b, ApiKeyAuth as c, AuthKind as d, AuthKindSchema as e, BedrockIamAuth as f, ClientOptions as g, ContentBlock as h, FormField as i, FormFieldType as j, GoogleServiceAccountAuth as k, LlmEvent as l, ModelCapabilities as m, ModelInfo as n, ToolCallEvent as o };
344
+ export type { AuthSpec as A, BedrockApiKeyAuth as B, CreateLlmArgs as C, FinishReason as F, GoogleApiKeyAuth as G, JsonSchema as J, LlmAdapter as L, Message as M, PromptRequest as P, Role as R, ServiceAccountJson as S, Tool as T, Usage as U, VertexServiceAccountAuth as V, AuthKindSchema as a, AdapterFactory as b, AdapterManifest as c, ApiKeyAuth as d, AuthKind as e, AzureOpenAIApiKeyAuth as f, BedrockIamAuth as g, ClientOptions as h, ContentBlock as i, FormField as j, FormFieldType as k, GoogleServiceAccountAuth as l, LlmEvent as m, ModelCapabilities as n, ModelInfo as o, ToolCallEvent as p };
@@ -103,12 +103,35 @@ interface Usage {
103
103
  outputTokens?: number;
104
104
  totalTokens?: number;
105
105
  }
106
- type AuthSpec = ApiKeyAuth | BedrockIamAuth | BedrockApiKeyAuth | GoogleApiKeyAuth | GoogleServiceAccountAuth | VertexServiceAccountAuth;
106
+ type AuthSpec = ApiKeyAuth | AzureOpenAIApiKeyAuth | BedrockIamAuth | BedrockApiKeyAuth | GoogleApiKeyAuth | GoogleServiceAccountAuth | VertexServiceAccountAuth;
107
107
  interface ApiKeyAuth {
108
108
  kind: 'apiKey';
109
109
  apiKey: string;
110
110
  baseURL?: string;
111
111
  }
112
+ /**
113
+ * Azure OpenAI Service uses an OpenAI-compatible wire protocol but differs
114
+ * from `api.openai.com` in three important ways:
115
+ * 1. Auth header is `api-key: {key}` (not `Authorization: Bearer {key}`).
116
+ * 2. The URL embeds the deployment name, not the model id:
117
+ * `https://{endpoint}/openai/deployments/{deployment}/chat/completions?api-version={version}`.
118
+ * The `model` field on the request is ignored by Azure; the deployment in
119
+ * the URL determines which model runs. Capability flags in the manifest
120
+ * are keyed by the underlying model (gpt-4o, gpt-4o-mini, ...).
121
+ * 3. `apiVersion` is a user-supplied knob — Microsoft rolls versions
122
+ * frequently and customers shouldn't need a library release to move to a
123
+ * newer one.
124
+ */
125
+ interface AzureOpenAIApiKeyAuth {
126
+ kind: 'azureOpenAIApiKey';
127
+ apiKey: string;
128
+ /** Resource endpoint, e.g. `https://my-resource.openai.azure.com`. No trailing slash. */
129
+ endpoint: string;
130
+ /** Deployment name the user created in Azure AI Studio / Azure OpenAI Studio. */
131
+ deployment: string;
132
+ /** Azure OpenAI data-plane api-version, e.g. `2024-10-21`. */
133
+ apiVersion: string;
134
+ }
112
135
  interface BedrockIamAuth {
113
136
  kind: 'bedrockIam';
114
137
  accessKeyId: string;
@@ -318,4 +341,4 @@ interface CreateLlmArgs<A extends AuthSpec = AuthSpec> {
318
341
  client?: ClientOptions;
319
342
  }
320
343
 
321
- export type { AuthSpec as A, BedrockApiKeyAuth as B, CreateLlmArgs as C, FinishReason as F, GoogleApiKeyAuth as G, JsonSchema as J, LlmAdapter as L, Message as M, PromptRequest as P, Role as R, ServiceAccountJson as S, Tool as T, Usage as U, VertexServiceAccountAuth as V, AdapterFactory as a, AdapterManifest as b, ApiKeyAuth as c, AuthKind as d, AuthKindSchema as e, BedrockIamAuth as f, ClientOptions as g, ContentBlock as h, FormField as i, FormFieldType as j, GoogleServiceAccountAuth as k, LlmEvent as l, ModelCapabilities as m, ModelInfo as n, ToolCallEvent as o };
344
+ export type { AuthSpec as A, BedrockApiKeyAuth as B, CreateLlmArgs as C, FinishReason as F, GoogleApiKeyAuth as G, JsonSchema as J, LlmAdapter as L, Message as M, PromptRequest as P, Role as R, ServiceAccountJson as S, Tool as T, Usage as U, VertexServiceAccountAuth as V, AuthKindSchema as a, AdapterFactory as b, AdapterManifest as c, ApiKeyAuth as d, AuthKind as e, AzureOpenAIApiKeyAuth as f, BedrockIamAuth as g, ClientOptions as h, ContentBlock as i, FormField as j, FormFieldType as k, GoogleServiceAccountAuth as l, LlmEvent as m, ModelCapabilities as n, ModelInfo as o, ToolCallEvent as p };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/llm",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "description": "Voice-oriented LLM adapter library — a uniform interface for streaming chat completions from multiple LLM vendors, with first-class support for tool calls, AbortSignal interruption, and lossless history round-tripping.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",