@llumiverse/drivers 0.23.0 → 0.24.0-dev.202601221707
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 +141 -218
- package/lib/cjs/azure/azure_foundry.js +46 -2
- package/lib/cjs/azure/azure_foundry.js.map +1 -1
- package/lib/cjs/bedrock/index.js +236 -16
- package/lib/cjs/bedrock/index.js.map +1 -1
- package/lib/cjs/groq/index.js +115 -85
- package/lib/cjs/groq/index.js.map +1 -1
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/openai/index.js +310 -114
- package/lib/cjs/openai/index.js.map +1 -1
- package/lib/cjs/openai/openai_compatible.js +62 -0
- package/lib/cjs/openai/openai_compatible.js.map +1 -0
- package/lib/cjs/openai/openai_format.js +32 -39
- package/lib/cjs/openai/openai_format.js.map +1 -1
- package/lib/cjs/vertexai/index.js +165 -0
- package/lib/cjs/vertexai/index.js.map +1 -1
- package/lib/cjs/vertexai/models/claude.js +201 -3
- package/lib/cjs/vertexai/models/claude.js.map +1 -1
- package/lib/cjs/vertexai/models/gemini.js +59 -20
- package/lib/cjs/vertexai/models/gemini.js.map +1 -1
- package/lib/cjs/xai/index.js +10 -16
- package/lib/cjs/xai/index.js.map +1 -1
- package/lib/esm/azure/azure_foundry.js +46 -2
- package/lib/esm/azure/azure_foundry.js.map +1 -1
- package/lib/esm/bedrock/index.js +236 -17
- package/lib/esm/bedrock/index.js.map +1 -1
- package/lib/esm/groq/index.js +115 -85
- package/lib/esm/groq/index.js.map +1 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/openai/index.js +311 -115
- package/lib/esm/openai/index.js.map +1 -1
- package/lib/esm/openai/openai_compatible.js +55 -0
- package/lib/esm/openai/openai_compatible.js.map +1 -0
- package/lib/esm/openai/openai_format.js +32 -39
- package/lib/esm/openai/openai_format.js.map +1 -1
- package/lib/esm/vertexai/index.js +166 -1
- package/lib/esm/vertexai/index.js.map +1 -1
- package/lib/esm/vertexai/models/claude.js +199 -3
- package/lib/esm/vertexai/models/claude.js.map +1 -1
- package/lib/esm/vertexai/models/gemini.js +60 -21
- package/lib/esm/vertexai/models/gemini.js.map +1 -1
- package/lib/esm/xai/index.js +10 -16
- package/lib/esm/xai/index.js.map +1 -1
- package/lib/types/azure/azure_foundry.d.ts +7 -5
- package/lib/types/azure/azure_foundry.d.ts.map +1 -1
- package/lib/types/bedrock/index.d.ts +21 -1
- package/lib/types/bedrock/index.d.ts.map +1 -1
- package/lib/types/groq/index.d.ts.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/openai/index.d.ts +13 -7
- package/lib/types/openai/index.d.ts.map +1 -1
- package/lib/types/openai/openai_compatible.d.ts +26 -0
- package/lib/types/openai/openai_compatible.d.ts.map +1 -0
- package/lib/types/openai/openai_format.d.ts +4 -2
- package/lib/types/openai/openai_format.d.ts.map +1 -1
- package/lib/types/vertexai/index.d.ts +15 -0
- package/lib/types/vertexai/index.d.ts.map +1 -1
- package/lib/types/vertexai/models/claude.d.ts +20 -0
- package/lib/types/vertexai/models/claude.d.ts.map +1 -1
- package/lib/types/vertexai/models/gemini.d.ts +1 -1
- package/lib/types/vertexai/models/gemini.d.ts.map +1 -1
- package/lib/types/xai/index.d.ts +2 -3
- package/lib/types/xai/index.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/azure/azure_foundry.ts +56 -7
- package/src/bedrock/index.ts +297 -26
- package/src/groq/index.ts +120 -94
- package/src/index.ts +1 -0
- package/src/openai/index.ts +363 -136
- package/src/openai/openai_compatible.ts +74 -0
- package/src/openai/openai_format.ts +44 -54
- package/src/vertexai/index.ts +205 -0
- package/src/vertexai/models/claude.ts +233 -3
- package/src/vertexai/models/gemini.ts +78 -27
- package/src/xai/index.ts +10 -17
package/lib/esm/xai/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { Providers } from "@llumiverse/core";
|
|
1
2
|
import { formatOpenAILikeMultimodalPrompt } from "../openai/openai_format.js";
|
|
2
3
|
import { FetchClient } from "@vertesia/api-fetch-client";
|
|
3
4
|
import OpenAI from "openai";
|
|
4
5
|
import { BaseOpenAIDriver } from "../openai/index.js";
|
|
5
6
|
export class xAIDriver extends BaseOpenAIDriver {
|
|
6
7
|
service;
|
|
7
|
-
provider;
|
|
8
|
+
provider = Providers.xai;
|
|
8
9
|
xai_service;
|
|
9
10
|
DEFAULT_ENDPOINT = "https://api.x.ai/v1";
|
|
10
11
|
constructor(opts) {
|
|
@@ -17,7 +18,6 @@ export class xAIDriver extends BaseOpenAIDriver {
|
|
|
17
18
|
baseURL: opts.endpoint ?? this.DEFAULT_ENDPOINT,
|
|
18
19
|
});
|
|
19
20
|
this.xai_service = new FetchClient(opts.endpoint ?? this.DEFAULT_ENDPOINT).withAuthCallback(async () => `Bearer ${opts.apiKey}`);
|
|
20
|
-
this.provider = "xai";
|
|
21
21
|
//this.formatPrompt = this._formatPrompt; //TODO: fix xai prompt formatting
|
|
22
22
|
}
|
|
23
23
|
async _formatPrompt(segments, opts) {
|
|
@@ -29,17 +29,9 @@ export class xAIDriver extends BaseOpenAIDriver {
|
|
|
29
29
|
const p = await formatOpenAILikeMultimodalPrompt(segments, { ...options, ...opts });
|
|
30
30
|
return p;
|
|
31
31
|
}
|
|
32
|
-
extractDataFromResponse
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
finish_reason: result.choices[0].finish_reason,
|
|
36
|
-
token_usage: {
|
|
37
|
-
prompt: result.usage?.prompt_tokens,
|
|
38
|
-
result: result.usage?.completion_tokens,
|
|
39
|
-
total: result.usage?.total_tokens,
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
32
|
+
// Note: We intentionally do NOT override extractDataFromResponse here.
|
|
33
|
+
// The base class implementation properly handles tool_calls extraction.
|
|
34
|
+
// xAI's API is OpenAI-compatible and returns tool_calls in the same format.
|
|
43
35
|
async listModels() {
|
|
44
36
|
const [lm, em] = await Promise.all([
|
|
45
37
|
this.xai_service.get("/language-models"),
|
|
@@ -52,10 +44,12 @@ export class xAIDriver extends BaseOpenAIDriver {
|
|
|
52
44
|
return {
|
|
53
45
|
id: model.id,
|
|
54
46
|
provider: this.provider,
|
|
55
|
-
name: model.
|
|
56
|
-
description: model.
|
|
47
|
+
name: model.id,
|
|
48
|
+
description: `${model.id} by ${model.owned_by}`,
|
|
57
49
|
is_multimodal: model.input_modalities.length > 1,
|
|
58
|
-
|
|
50
|
+
input_modalities: model.input_modalities,
|
|
51
|
+
output_modalities: model.output_modalities,
|
|
52
|
+
tags: [...model.input_modalities.map(m => `i:${m}`), ...model.output_modalities.map(m => `o:${m}`)],
|
|
59
53
|
};
|
|
60
54
|
});
|
|
61
55
|
return models;
|
package/lib/esm/xai/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/xai/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/xai/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwD,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAAE,gCAAgC,EAAgC,MAAM,4BAA4B,CAAC;AAC5G,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAUtD,MAAM,OAAO,SAAU,SAAQ,gBAAgB;IAE3C,OAAO,CAAS;IACP,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC;IAClC,WAAW,CAAc;IACzB,gBAAgB,GAAG,qBAAqB,CAAC;IAEzC,YAAY,IAAsB;QAC9B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACf,MAAM,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EH,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YACpD,OAAO;gBACH,EAAE,EAAE,KAAK,CAAC,EAAE;gBACZ,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,IAAI,EAAE,KAAK,CAAC,EAAE;gBACd,WAAW,EAAE,GAAG,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC,QAAQ,EAAE;gBAC/C,aAAa,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC;gBAChD,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;gBACxC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;gBAC1C,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;aACpF,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAElB,CAAC;CAGJ"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { TokenCredential } from "@azure/identity";
|
|
2
2
|
import { AbstractDriver, AIModel, Completion, CompletionChunkObject, DriverOptions, EmbeddingsOptions, EmbeddingsResult, ExecutionOptions, Providers } from "@llumiverse/core";
|
|
3
3
|
import { AIProjectClient, ModelDeployment } from '@azure/ai-projects';
|
|
4
|
-
import
|
|
4
|
+
import type OpenAI from "openai";
|
|
5
5
|
import type { ChatRequestMessage } from "@azure-rest/ai-inference";
|
|
6
|
+
type ResponseInputItem = OpenAI.Responses.ResponseInputItem;
|
|
6
7
|
export interface AzureFoundryDriverOptions extends DriverOptions {
|
|
7
8
|
/**
|
|
8
9
|
* The credentials to use to access Azure AI Foundry
|
|
@@ -15,10 +16,10 @@ export interface AzureFoundryInferencePrompt {
|
|
|
15
16
|
messages: ChatRequestMessage[];
|
|
16
17
|
}
|
|
17
18
|
export interface AzureFoundryOpenAIPrompt {
|
|
18
|
-
messages:
|
|
19
|
+
messages: ResponseInputItem[];
|
|
19
20
|
}
|
|
20
21
|
export type AzureFoundryPrompt = AzureFoundryInferencePrompt | AzureFoundryOpenAIPrompt;
|
|
21
|
-
export declare class AzureFoundryDriver extends AbstractDriver<AzureFoundryDriverOptions,
|
|
22
|
+
export declare class AzureFoundryDriver extends AbstractDriver<AzureFoundryDriverOptions, ResponseInputItem[]> {
|
|
22
23
|
service: AIProjectClient;
|
|
23
24
|
readonly provider = Providers.azure_foundry;
|
|
24
25
|
OPENAI_API_VERSION: string;
|
|
@@ -30,8 +31,8 @@ export declare class AzureFoundryDriver extends AbstractDriver<AzureFoundryDrive
|
|
|
30
31
|
getDefaultAIFoundryAuth(): () => Promise<string>;
|
|
31
32
|
isOpenAIDeployment(model: string): Promise<boolean>;
|
|
32
33
|
protected canStream(_options: ExecutionOptions): Promise<boolean>;
|
|
33
|
-
requestTextCompletion(prompt:
|
|
34
|
-
requestTextCompletionStream(prompt:
|
|
34
|
+
requestTextCompletion(prompt: ResponseInputItem[], options: ExecutionOptions): Promise<Completion>;
|
|
35
|
+
requestTextCompletionStream(prompt: ResponseInputItem[], options: ExecutionOptions): Promise<AsyncIterable<CompletionChunkObject>>;
|
|
35
36
|
private processStreamResponse;
|
|
36
37
|
private extractDataFromResponse;
|
|
37
38
|
private convertFinishReason;
|
|
@@ -47,4 +48,5 @@ export declare function parseAzureFoundryModelId(compositeId: string): {
|
|
|
47
48
|
baseModel: string;
|
|
48
49
|
};
|
|
49
50
|
export declare function isCompositeModelId(modelId: string): boolean;
|
|
51
|
+
export {};
|
|
50
52
|
//# sourceMappingURL=azure_foundry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"azure_foundry.d.ts","sourceRoot":"","sources":["../../../src/azure/azure_foundry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,aAAa,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAgD,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7N,OAAO,EAAE,eAAe,EAAmB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEvF,OAAO,
|
|
1
|
+
{"version":3,"file":"azure_foundry.d.ts","sourceRoot":"","sources":["../../../src/azure/azure_foundry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,aAAa,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAgD,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7N,OAAO,EAAE,eAAe,EAAmB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEvF,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAGR,kBAAkB,EACrB,MAAM,0BAA0B,CAAC;AAKlC,KAAK,iBAAiB,GAAG,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC;AAE5D,MAAM,WAAW,yBAA0B,SAAQ,aAAa;IAC5D;;OAEG;IACH,oBAAoB,CAAC,EAAE,eAAe,CAAC;IAEvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,2BAA2B;IACxC,QAAQ,EAAE,kBAAkB,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,wBAAwB;IACrC,QAAQ,EAAE,iBAAiB,EAAE,CAAA;CAChC;AAED,MAAM,MAAM,kBAAkB,GAAG,2BAA2B,GAAG,wBAAwB,C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AC,SAAS,EAAE,MAAM,CAAA;CAAE,CAc3G;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE3D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bedrock, FoundationModelSummary } from "@aws-sdk/client-bedrock";
|
|
2
|
-
import { BedrockRuntime, ConverseRequest, ConverseResponse, ConverseStreamOutput } from "@aws-sdk/client-bedrock-runtime";
|
|
2
|
+
import { BedrockRuntime, ConverseRequest, ConverseResponse, ConverseStreamOutput, Message } from "@aws-sdk/client-bedrock-runtime";
|
|
3
3
|
import { AwsCredentialIdentity, Provider } from "@aws-sdk/types";
|
|
4
4
|
import { AbstractDriver, AIModel, Completion, CompletionChunkObject, DataSource, DriverOptions, EmbeddingsOptions, EmbeddingsResult, ExecutionOptions, PromptSegment, TrainingJob, TrainingOptions } from "@llumiverse/core";
|
|
5
5
|
import { NovaMessagesPrompt } from "@llumiverse/core/formatters";
|
|
@@ -43,6 +43,11 @@ export declare class BedrockDriver extends AbstractDriver<BedrockDriverOptions,
|
|
|
43
43
|
extractRegion(modelString: string, defaultRegion: string): string;
|
|
44
44
|
private getCanStream;
|
|
45
45
|
protected canStream(options: ExecutionOptions): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Build conversation context after streaming completion.
|
|
48
|
+
* Reconstructs the assistant message from accumulated results and applies stripping.
|
|
49
|
+
*/
|
|
50
|
+
buildStreamingConversation(prompt: BedrockPrompt, result: unknown[], toolUse: unknown[] | undefined, options: ExecutionOptions): ConverseRequest | undefined;
|
|
46
51
|
requestTextCompletion(prompt: BedrockPrompt, options: ExecutionOptions): Promise<Completion>;
|
|
47
52
|
private requestTwelvelabsPegasusCompletion;
|
|
48
53
|
private requestTwelvelabsPegasusCompletionStream;
|
|
@@ -59,5 +64,20 @@ export declare class BedrockDriver extends AbstractDriver<BedrockDriverOptions,
|
|
|
59
64
|
_listModels(foundationFilter?: (m: FoundationModelSummary) => boolean): Promise<AIModel[]>;
|
|
60
65
|
generateEmbeddings({ text, image, model }: EmbeddingsOptions): Promise<EmbeddingsResult>;
|
|
61
66
|
private generateTwelvelabsMarengoEmbeddings;
|
|
67
|
+
/**
|
|
68
|
+
* Cleanup AWS SDK clients when the driver is evicted from the cache.
|
|
69
|
+
*/
|
|
70
|
+
destroy(): void;
|
|
62
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Fix orphaned toolUse blocks in the conversation.
|
|
74
|
+
*
|
|
75
|
+
* When an agent is stopped mid-tool-execution, the assistant message contains toolUse blocks
|
|
76
|
+
* but no corresponding toolResult was added. The AWS Converse API requires that every toolUse
|
|
77
|
+
* must be followed by a toolResult in the next user message.
|
|
78
|
+
*
|
|
79
|
+
* This function detects such cases and injects synthetic toolResult blocks indicating
|
|
80
|
+
* the tools were interrupted, allowing the conversation to continue.
|
|
81
|
+
*/
|
|
82
|
+
export declare function fixOrphanedToolUse(messages: Message[]): Message[];
|
|
63
83
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bedrock/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EAAsC,sBAAsB,EAEtE,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bedrock/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EAAsC,sBAAsB,EAEtE,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAgB,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAA0B,OAAO,EAAQ,MAAM,iCAAiC,CAAC;AAE/K,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EACH,cAAc,EAAE,OAAO,EAIvB,UAAU,EAAE,qBAAqB,EAAE,UAAU,EAAE,aAAa,EAAE,i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AU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAQhC,WAAW,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,sBAAsB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAmK1F,kBAAkB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;YA2ChF,mCAAmC;IA6CjD;;OAEG;IACH,OAAO,IAAI,IAAI;CAIlB;AAyFD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAoFjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/groq/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,qBAAqB,EAAE,aAAa,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAgD,MAAM,kBAAkB,CAAC;AAIjO,OAAO,IAAI,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/groq/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,qBAAqB,EAAE,aAAa,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAgD,MAAM,kBAAkB,CAAC;AAIjO,OAAO,IAAI,MAAM,UAAU,CAAC;AAE5B,OAAO,KAAK,EAAE,0BAA0B,EAAsB,MAAM,qCAAqC,CAAC;AAM1G,UAAU,iBAAkB,SAAQ,aAAa;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,qBAAa,UAAW,SAAQ,cAAc,CAAC,iBAAiB,EAAE,0BAA0B,EAAE,CAAC;IAC3F,MAAM,CAAC,QAAQ,SAAU;IACzB,QAAQ,SAAuB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,IAAI,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;gBAET,OAAO,EAAE,iBAAiB;IAkBtC,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,SAAS;cAWxC,YAAY,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,0BAA0B,EAAE,CAAC;IAWtH,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,uBAAuB;IAiBzB,qBAAqB,CAAC,QAAQ,EAAE,0BAA0B,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IAwD7G,2BAA2B,CAAC,QAAQ,EAAE,0BAA0B,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAiD7I,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;IAuB9C,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;IAIhC,kBAAkB,CAAC,EAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAI9E"}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./huggingface_ie.js";
|
|
|
5
5
|
export * from "./mistral/index.js";
|
|
6
6
|
export * from "./openai/azure_openai.js";
|
|
7
7
|
export * from "./openai/openai.js";
|
|
8
|
+
export * from "./openai/openai_compatible.js";
|
|
8
9
|
export * from "./replicate.js";
|
|
9
10
|
export * from "./test-driver/index.js";
|
|
10
11
|
export * from "./togetherai/index.js";
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { AIModel, AbstractDriver, Completion, CompletionChunkObject, DataSource, DriverOptions, EmbeddingsOptions, EmbeddingsResult, ExecutionOptions, Providers, ToolUse, TrainingJob, TrainingOptions, TrainingPromptOptions } from "@llumiverse/core";
|
|
2
2
|
import OpenAI, { AzureOpenAI } from "openai";
|
|
3
|
-
|
|
3
|
+
type ResponseInputItem = OpenAI.Responses.ResponseInputItem;
|
|
4
4
|
export interface BaseOpenAIDriverOptions extends DriverOptions {
|
|
5
5
|
}
|
|
6
|
-
export declare abstract class BaseOpenAIDriver extends AbstractDriver<BaseOpenAIDriverOptions,
|
|
7
|
-
abstract provider: Providers.openai | Providers.azure_openai |
|
|
6
|
+
export declare abstract class BaseOpenAIDriver extends AbstractDriver<BaseOpenAIDriverOptions, ResponseInputItem[]> {
|
|
7
|
+
abstract provider: Providers.openai | Providers.azure_openai | Providers.xai | Providers.azure_foundry | Providers.openai_compatible;
|
|
8
8
|
abstract service: OpenAI | AzureOpenAI;
|
|
9
9
|
constructor(opts: BaseOpenAIDriverOptions);
|
|
10
|
-
extractDataFromResponse(_options: ExecutionOptions, result: OpenAI.
|
|
11
|
-
requestTextCompletionStream(prompt:
|
|
12
|
-
requestTextCompletion(prompt:
|
|
10
|
+
extractDataFromResponse(_options: ExecutionOptions, result: OpenAI.Responses.Response): Completion;
|
|
11
|
+
requestTextCompletionStream(prompt: ResponseInputItem[], options: ExecutionOptions): Promise<AsyncIterable<CompletionChunkObject>>;
|
|
12
|
+
requestTextCompletion(prompt: ResponseInputItem[], options: ExecutionOptions): Promise<Completion>;
|
|
13
13
|
protected canStream(_options: ExecutionOptions): Promise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* Build conversation context after streaming completion.
|
|
16
|
+
* Reconstructs the assistant message from accumulated results and applies stripping.
|
|
17
|
+
*/
|
|
18
|
+
buildStreamingConversation(prompt: ResponseInputItem[], result: unknown[], toolUse: unknown[] | undefined, options: ExecutionOptions): ResponseInputItem[] | undefined;
|
|
14
19
|
createTrainingPrompt(options: TrainingPromptOptions): Promise<string>;
|
|
15
20
|
startTraining(dataset: DataSource, options: TrainingOptions): Promise<TrainingJob>;
|
|
16
21
|
cancelTraining(jobId: string): Promise<TrainingJob>;
|
|
@@ -21,5 +26,6 @@ export declare abstract class BaseOpenAIDriver extends AbstractDriver<BaseOpenAI
|
|
|
21
26
|
_listModels(filter?: (m: OpenAI.Models.Model) => boolean): Promise<AIModel[]>;
|
|
22
27
|
generateEmbeddings({ text, image, model }: EmbeddingsOptions): Promise<EmbeddingsResult>;
|
|
23
28
|
}
|
|
24
|
-
export declare function collectTools(
|
|
29
|
+
export declare function collectTools(output?: OpenAI.Responses.ResponseOutputItem[]): ToolUse[] | undefined;
|
|
30
|
+
export {};
|
|
25
31
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/openai/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EACP,cAAc,EACd,UAAU,EACV,qBAAqB,EAErB,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAIhB,SAAS,EAET,OAAO,EACP,WAAW,EAEX,eAAe,EACf,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/openai/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EACP,cAAc,EACd,UAAU,EACV,qBAAqB,EAErB,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAIhB,SAAS,EAET,OAAO,EACP,WAAW,EAEX,eAAe,EACf,qBAAqB,EASxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAI7C,KAAK,iBAAiB,GAAG,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC;AAiB5D,MAAM,WAAW,uBAAwB,SAAQ,aAAa;CAC7D;AAED,8BAAsB,gBAAiB,SAAQ,cAAc,CACzD,uBAAuB,EACvB,iBAAiB,EAAE,CACtB;IACG,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,YAAY,GAAG,SAAS,CAAC,GAAG,GAAG,SAAS,CAAC,aAAa,GAAG,SAAS,CAAC,iBAAiB,CAAC;IACrI,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC;gBAE3B,IAAI,EAAE,uBAAuB;IAKzC,uBAAuB,CACnB,QAAQ,EAAE,gBAAgB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C,EAAE,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAwB5H;AAyPD,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC,kBAAkB,EAAE,GAAG,OAAO,EAAE,GAAG,SAAS,CAoBlG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AIModel, DriverOptions, Providers } from "@llumiverse/core";
|
|
2
|
+
import OpenAI from "openai";
|
|
3
|
+
import { BaseOpenAIDriver } from "./index.js";
|
|
4
|
+
export interface OpenAICompatibleDriverOptions extends DriverOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The API key for the OpenAI-compatible service
|
|
7
|
+
*/
|
|
8
|
+
apiKey: string;
|
|
9
|
+
/**
|
|
10
|
+
* The base URL of the OpenAI-compatible API endpoint
|
|
11
|
+
* Example: https://api.example.com/v1
|
|
12
|
+
*/
|
|
13
|
+
endpoint: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A generic driver for OpenAI-compatible APIs.
|
|
17
|
+
* This can be used with any service that implements the OpenAI API spec,
|
|
18
|
+
* such as xAI (Grok), LM Studio, Ollama, vLLM, LocalAI, etc.
|
|
19
|
+
*/
|
|
20
|
+
export declare class OpenAICompatibleDriver extends BaseOpenAIDriver {
|
|
21
|
+
service: OpenAI;
|
|
22
|
+
readonly provider = Providers.openai_compatible;
|
|
23
|
+
constructor(opts: OpenAICompatibleDriverOptions);
|
|
24
|
+
listModels(): Promise<AIModel[]>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=openai_compatible.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai_compatible.d.ts","sourceRoot":"","sources":["../../../src/openai/openai_compatible.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAa,SAAS,EAAgD,MAAM,kBAAkB,CAAC;AAC9H,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,6BAA8B,SAAQ,aAAa;IAChE;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,gBAAgB;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,QAAQ,+BAA+B;gBAEpC,IAAI,EAAE,6BAA6B;IAiBzC,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;CA8BzC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PromptOptions, PromptSegment } from "@llumiverse/common";
|
|
2
|
-
import type
|
|
2
|
+
import type OpenAI from "openai";
|
|
3
|
+
type ResponseInputItem = OpenAI.Responses.ResponseInputItem;
|
|
3
4
|
export interface OpenAITextMessage {
|
|
4
5
|
content: string;
|
|
5
6
|
role: 'system' | 'user' | 'assistant' | 'developer';
|
|
@@ -10,10 +11,11 @@ export interface OpenAITextMessage {
|
|
|
10
11
|
* @returns
|
|
11
12
|
*/
|
|
12
13
|
export declare function formatOpenAILikeTextPrompt(segments: PromptSegment[]): OpenAITextMessage[];
|
|
13
|
-
export declare function formatOpenAILikeMultimodalPrompt(segments: PromptSegment[], opts: PromptOptions & OpenAIPromptFormatterOptions): Promise<
|
|
14
|
+
export declare function formatOpenAILikeMultimodalPrompt(segments: PromptSegment[], opts: PromptOptions & OpenAIPromptFormatterOptions): Promise<ResponseInputItem[]>;
|
|
14
15
|
export interface OpenAIPromptFormatterOptions {
|
|
15
16
|
multimodal?: boolean;
|
|
16
17
|
useToolForFormatting?: boolean;
|
|
17
18
|
schema?: Object;
|
|
18
19
|
}
|
|
20
|
+
export {};
|
|
19
21
|
//# sourceMappingURL=openai_format.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai_format.d.ts","sourceRoot":"","sources":["../../../src/openai/openai_format.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"openai_format.d.ts","sourceRoot":"","sources":["../../../src/openai/openai_format.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE9E,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAGjC,KAAK,iBAAiB,GAAG,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC;AAI5D,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,WAAW,CAAC;CACvD;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,iBAAiB,EAAE,CAoBzF;AAGD,wBAAsB,gCAAgC,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,aAAa,GAAG,4BAA4B,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAuGlK;AAED,MAAM,WAAW,4BAA4B;IACzC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;CAClB"}
|
|
@@ -45,10 +45,25 @@ export declare class VertexAIDriver extends AbstractDriver<VertexAIDriverOptions
|
|
|
45
45
|
createPrompt(segments: PromptSegment[], options: ExecutionOptions): Promise<VertexAIPrompt>;
|
|
46
46
|
requestTextCompletion(prompt: VertexAIPrompt, options: ExecutionOptions): Promise<Completion>;
|
|
47
47
|
requestTextCompletionStream(prompt: VertexAIPrompt, options: ExecutionOptions): Promise<AsyncIterable<CompletionChunkObject>>;
|
|
48
|
+
/**
|
|
49
|
+
* Build conversation context after streaming completion.
|
|
50
|
+
* Reconstructs the assistant message from accumulated results and applies stripping.
|
|
51
|
+
* Handles both Gemini (Content[]) and Claude (ClaudePrompt) formats.
|
|
52
|
+
*/
|
|
53
|
+
buildStreamingConversation(prompt: VertexAIPrompt, result: unknown[], toolUse: unknown[] | undefined, options: ExecutionOptions): Content[] | unknown | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Build conversation for Claude streaming.
|
|
56
|
+
* Creates assistant message with tool_use blocks in Claude's ContentBlock format.
|
|
57
|
+
*/
|
|
58
|
+
private buildClaudeStreamingConversation;
|
|
48
59
|
requestImageGeneration(_prompt: ImagenPrompt, _options: ExecutionOptions): Promise<Completion>;
|
|
49
60
|
getGenAIModelsArray(client: GoogleGenAI): Promise<Model[]>;
|
|
50
61
|
listModels(_params?: ModelSearchPayload): Promise<AIModel<string>[]>;
|
|
51
62
|
validateConnection(): Promise<boolean>;
|
|
52
63
|
generateEmbeddings(options: EmbeddingsOptions): Promise<EmbeddingsResult>;
|
|
64
|
+
/**
|
|
65
|
+
* Cleanup Google Cloud clients when the driver is evicted from the cache.
|
|
66
|
+
*/
|
|
67
|
+
destroy(): void;
|
|
53
68
|
}
|
|
54
69
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vertexai/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EACH,OAAO,EACP,cAAc,EACd,UAAU,EACV,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vertexai/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,uBAA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AE,gBAAgB,GAC1B,OAAO,EAAE,GAAG,OAAO,GAAG,SAAS;IAwFlC;;;OAGG;IACH,OAAO,CAAC,gCAAgC;IAwFlC,sBAAsB,CACxB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,gBAAgB,GAC3B,OAAO,CAAC,UAAU,CAAC;IAMhB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAS1D,UAAU,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;IAkN1E,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;IAIhC,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAc/E;;OAEG;IACH,OAAO,IAAI,IAAI;CAKlB"}
|
|
@@ -16,5 +16,25 @@ export declare class ClaudeModelDefinition implements ModelDefinition<ClaudeProm
|
|
|
16
16
|
requestTextCompletion(driver: VertexAIDriver, prompt: ClaudePrompt, options: ExecutionOptions): Promise<Completion>;
|
|
17
17
|
requestTextCompletionStream(driver: VertexAIDriver, prompt: ClaudePrompt, options: ExecutionOptions): Promise<AsyncIterable<CompletionChunkObject>>;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Merge consecutive user messages in the conversation.
|
|
21
|
+
* This is required because Anthropic's API expects all tool_result blocks
|
|
22
|
+
* from a single assistant turn to be in one user message.
|
|
23
|
+
* When multiple tool results are added as separate user messages,
|
|
24
|
+
* we need to merge them before sending to the API.
|
|
25
|
+
*/
|
|
26
|
+
export declare function mergeConsecutiveUserMessages(messages: MessageParam[]): MessageParam[];
|
|
27
|
+
/**
|
|
28
|
+
* Fix orphaned tool_use blocks in the conversation.
|
|
29
|
+
* @exported for testing
|
|
30
|
+
*
|
|
31
|
+
* When an agent is stopped mid-tool-execution, the assistant message contains tool_use blocks
|
|
32
|
+
* but no corresponding tool_result was added. The Anthropic API requires that every tool_use
|
|
33
|
+
* must be followed by a tool_result in the next user message.
|
|
34
|
+
*
|
|
35
|
+
* This function detects such cases and injects synthetic tool_result blocks indicating
|
|
36
|
+
* the tools were interrupted, allowing the conversation to continue.
|
|
37
|
+
*/
|
|
38
|
+
export declare function fixOrphanedToolUse(messages: MessageParam[]): MessageParam[];
|
|
19
39
|
export {};
|
|
20
40
|
//# sourceMappingURL=claude.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../../src/vertexai/models/claude.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAmE,YAAY,EAAE,cAAc,EAAwB,MAAM,sCAAsC,CAAC;AACzL,OAAO,EACH,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,gBAAgB,EAChD,aAAa,EAAqE,OAAO,EACxG,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/C,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAIpD,CAAA;AAED,eAAO,MAAM,2BAA2B,UAGvC,CAAC;AAEF,UAAU,YAAY;IAClB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;CAC7B;AAWD,wBAAgB,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,EAAE,GAAG,SAAS,CAc3E;AA+FD,qBAAa,qBAAsB,YAAW,eAAe,CAAC,YAAY,CAAC;IAEvE,KAAK,EAAE,OAAO,CAAA;gBAEF,OAAO,EAAE,MAAM;IAUrB,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;IAuGlH,qBAAqB,CAA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AE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IA6CnH,2BAA2B,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;CAgI5J;AAYD;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CA6CrF;AA6DD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CA2E3E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Content, GenerateContentResponseUsageMetadata } from "@google/genai";
|
|
2
2
|
import { AIModel, Completion, CompletionChunkObject, ExecutionOptions, ExecutionTokenUsage, PromptSegment } from "@llumiverse/core";
|
|
3
|
-
import {
|
|
3
|
+
import { GenerateContentPrompt, VertexAIDriver } from "../index.js";
|
|
4
4
|
import { ModelDefinition } from "../models.js";
|
|
5
5
|
export declare function mergeConsecutiveRole(contents: Content[] | undefined): Content[];
|
|
6
6
|
export declare class GeminiModelDefinition implements ModelDefinition<GenerateContentPrompt> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../../../src/vertexai/models/gemini.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EACP,oCAAoC,EAEvC,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAoB,gBAAgB,EAC9E,mBAAmB,
|
|
1
|
+
{"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../../../src/vertexai/models/gemini.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EACP,oCAAoC,EAEvC,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAoB,gBAAgB,EAC9E,mBAAmB,EAKnB,aAAa,EAMhB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAwd/C,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,CA2B/E;AAoDD,qBAAa,qBAAsB,YAAW,eAAe,CAAC,qBAAqB,CAAC;IAEhF,KAAK,EAAE,OAAO,CAAA;gBAEF,OAAO,EAAE,MAAM;IAU3B,uBAAuB,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,gBAAgB,GAAG;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,OAAO,EAAE,gBAAgB,CAAA;KAAE;IAyBnH,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA+HjI,yBAAyB,CAAC,aAAa,EAAE,oCAAoC,GAAG,SAAS,GAAG,mBAAmB;IA0BzG,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,qBAAqB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IAoF5H,2BAA2B,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,qBAAqB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;CAkErK"}
|
package/lib/types/xai/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AIModel,
|
|
1
|
+
import { AIModel, DriverOptions, PromptOptions, PromptSegment, Providers } from "@llumiverse/core";
|
|
2
2
|
import { FetchClient } from "@vertesia/api-fetch-client";
|
|
3
3
|
import OpenAI from "openai";
|
|
4
4
|
import { BaseOpenAIDriver } from "../openai/index.js";
|
|
@@ -8,12 +8,11 @@ export interface xAiDriverOptions extends DriverOptions {
|
|
|
8
8
|
}
|
|
9
9
|
export declare class xAIDriver extends BaseOpenAIDriver {
|
|
10
10
|
service: OpenAI;
|
|
11
|
-
provider
|
|
11
|
+
readonly provider = Providers.xai;
|
|
12
12
|
xai_service: FetchClient;
|
|
13
13
|
DEFAULT_ENDPOINT: string;
|
|
14
14
|
constructor(opts: xAiDriverOptions);
|
|
15
15
|
_formatPrompt(segments: PromptSegment[], opts: PromptOptions): Promise<OpenAI.Chat.Completions.ChatCompletionMessageParam[]>;
|
|
16
|
-
extractDataFromResponse(_options: ExecutionOptions, result: OpenAI.Chat.Completions.ChatCompletion): Completion;
|
|
17
16
|
listModels(): Promise<AIModel[]>;
|
|
18
17
|
}
|
|
19
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/xai/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/xai/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEnG,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IAEnD,MAAM,EAAE,MAAM,CAAC;IAEf,QAAQ,CAAC,EAAE,MAAM,CAAC;CAErB;AAED,qBAAa,SAAU,SAAQ,gBAAgB;IAE3C,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,QAAQ,iBAAiB;IAClC,WAAW,EAAE,WAAW,CAAC;IACzB,gBAAgB,SAAyB;gBAE7B,IAAI,EAAE,gBAAgB;IAe5B,aAAa,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,0BAA0B,EAAE,CAAC;IAkB5H,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;CA6BzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llumiverse/drivers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0-dev.202601221707",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "LLM driver implementations. Currently supported are: openai, huggingface, bedrock, replicate.",
|
|
6
6
|
"files": [
|
|
@@ -45,16 +45,16 @@
|
|
|
45
45
|
"rimraf": "^6.1.2",
|
|
46
46
|
"ts-dual-module": "^0.6.3",
|
|
47
47
|
"typescript": "^5.9.3",
|
|
48
|
-
"vitest": "^
|
|
48
|
+
"vitest": "^4.0.16"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@anthropic-ai/sdk": "^0.71.2",
|
|
52
52
|
"@anthropic-ai/vertex-sdk": "^0.14.0",
|
|
53
|
-
"@aws-sdk/client-bedrock": "^3.
|
|
54
|
-
"@aws-sdk/client-bedrock-runtime": "^3.
|
|
55
|
-
"@aws-sdk/client-s3": "^3.
|
|
56
|
-
"@aws-sdk/credential-providers": "^3.
|
|
57
|
-
"@aws-sdk/lib-storage": "^3.
|
|
53
|
+
"@aws-sdk/client-bedrock": "^3.952.0",
|
|
54
|
+
"@aws-sdk/client-bedrock-runtime": "^3.952.0",
|
|
55
|
+
"@aws-sdk/client-s3": "^3.952.0",
|
|
56
|
+
"@aws-sdk/credential-providers": "^3.952.0",
|
|
57
|
+
"@aws-sdk/lib-storage": "^3.952.0",
|
|
58
58
|
"@aws-sdk/types": "^3.936.0",
|
|
59
59
|
"@azure-rest/ai-inference": "1.0.0-beta.6",
|
|
60
60
|
"@azure/ai-projects": "1.0.0-beta.10",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@azure/core-sse": "^2.3.0",
|
|
63
63
|
"@azure/identity": "^4.13.0",
|
|
64
64
|
"@azure/openai": "2.0.0",
|
|
65
|
-
"@google-cloud/aiplatform": "^
|
|
65
|
+
"@google-cloud/aiplatform": "^6.0.0",
|
|
66
66
|
"@google/genai": "^1.31.0",
|
|
67
67
|
"@huggingface/inference": "4.13.4",
|
|
68
68
|
"@vertesia/api-fetch-client": "^0.79.3",
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
"groq-sdk": "^0.37.0",
|
|
72
72
|
"mnemonist": "^0.40.3",
|
|
73
73
|
"node-web-stream-adapters": "^0.2.1",
|
|
74
|
-
"openai": "^
|
|
75
|
-
"replicate": "^1.
|
|
76
|
-
"@llumiverse/
|
|
77
|
-
"@llumiverse/
|
|
74
|
+
"openai": "^6.10.0",
|
|
75
|
+
"replicate": "^1.3.1",
|
|
76
|
+
"@llumiverse/common": "0.24.0-dev.202601221707",
|
|
77
|
+
"@llumiverse/core": "0.24.0-dev.202601221707"
|
|
78
78
|
},
|
|
79
79
|
"ts_dual_module": {
|
|
80
80
|
"outDir": "lib"
|