@tanstack/ai-grok 0.14.2 → 0.14.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/package.json +4 -4
- package/dist/esm/adapters/image.d.ts +0 -89
- package/dist/esm/adapters/image.js +0 -205
- package/dist/esm/adapters/image.js.map +0 -1
- package/dist/esm/adapters/summarize.d.ts +0 -51
- package/dist/esm/adapters/summarize.js +0 -20
- package/dist/esm/adapters/summarize.js.map +0 -1
- package/dist/esm/adapters/text.d.ts +0 -76
- package/dist/esm/adapters/text.js +0 -44
- package/dist/esm/adapters/text.js.map +0 -1
- package/dist/esm/adapters/transcription.d.ts +0 -84
- package/dist/esm/adapters/transcription.js +0 -122
- package/dist/esm/adapters/transcription.js.map +0 -1
- package/dist/esm/adapters/tts.d.ts +0 -70
- package/dist/esm/adapters/tts.js +0 -142
- package/dist/esm/adapters/tts.js.map +0 -1
- package/dist/esm/adapters/video.d.ts +0 -128
- package/dist/esm/adapters/video.js +0 -237
- package/dist/esm/adapters/video.js.map +0 -1
- package/dist/esm/audio/transcription-provider-options.d.ts +0 -41
- package/dist/esm/audio/tts-provider-options.d.ts +0 -42
- package/dist/esm/image/image-provider-options.d.ts +0 -133
- package/dist/esm/image/image-provider-options.js +0 -76
- package/dist/esm/image/image-provider-options.js.map +0 -1
- package/dist/esm/index.d.ts +0 -16
- package/dist/esm/index.js +0 -40
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/message-types.d.ts +0 -64
- package/dist/esm/model-meta.d.ts +0 -99
- package/dist/esm/model-meta.js +0 -58
- package/dist/esm/model-meta.js.map +0 -1
- package/dist/esm/realtime/adapter.d.ts +0 -21
- package/dist/esm/realtime/adapter.js +0 -823
- package/dist/esm/realtime/adapter.js.map +0 -1
- package/dist/esm/realtime/index.d.ts +0 -4
- package/dist/esm/realtime/token.d.ts +0 -22
- package/dist/esm/realtime/token.js +0 -75
- package/dist/esm/realtime/token.js.map +0 -1
- package/dist/esm/realtime/types.d.ts +0 -95
- package/dist/esm/text/text-provider-options.d.ts +0 -54
- package/dist/esm/tools/index.d.ts +0 -45
- package/dist/esm/tools/index.js +0 -113
- package/dist/esm/tools/index.js.map +0 -1
- package/dist/esm/utils/audio.d.ts +0 -23
- package/dist/esm/utils/audio.js +0 -172
- package/dist/esm/utils/audio.js.map +0 -1
- package/dist/esm/utils/client.d.ts +0 -14
- package/dist/esm/utils/client.js +0 -21
- package/dist/esm/utils/client.js.map +0 -1
- package/dist/esm/utils/index.d.ts +0 -4
- package/dist/esm/utils/schema-converter.d.ts +0 -2
- package/dist/esm/video/video-provider-options.d.ts +0 -135
- package/dist/esm/video/video-provider-options.js +0 -67
- package/dist/esm/video/video-provider-options.js.map +0 -1
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Grok-specific metadata types for multimodal content parts.
|
|
3
|
-
* These types extend the base ContentPart metadata with Grok-specific options.
|
|
4
|
-
*
|
|
5
|
-
* Grok uses an OpenAI-compatible API, so metadata types are similar to OpenAI.
|
|
6
|
-
*
|
|
7
|
-
* @see https://docs.x.ai
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Metadata for Grok image content parts.
|
|
11
|
-
* Controls how the model processes and analyzes images.
|
|
12
|
-
*/
|
|
13
|
-
export interface GrokImageMetadata {
|
|
14
|
-
/**
|
|
15
|
-
* Controls how the model processes the image.
|
|
16
|
-
* - 'auto': Let the model decide based on image size and content
|
|
17
|
-
* - 'low': Use low resolution processing (faster, cheaper, less detail)
|
|
18
|
-
* - 'high': Use high resolution processing (slower, more expensive, more detail)
|
|
19
|
-
*
|
|
20
|
-
* @default 'auto'
|
|
21
|
-
*/
|
|
22
|
-
detail?: 'auto' | 'low' | 'high';
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Metadata for Grok audio content parts.
|
|
26
|
-
* Specifies the audio format for proper processing.
|
|
27
|
-
*/
|
|
28
|
-
export interface GrokAudioMetadata {
|
|
29
|
-
/**
|
|
30
|
-
* The format of the audio.
|
|
31
|
-
* Supported formats: mp3, wav, flac, etc.
|
|
32
|
-
* @default 'mp3'
|
|
33
|
-
*/
|
|
34
|
-
format?: 'mp3' | 'wav' | 'flac' | 'ogg' | 'webm' | 'aac';
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Metadata for Grok video content parts.
|
|
38
|
-
* Note: Video support in Grok is limited; check current API capabilities.
|
|
39
|
-
*/
|
|
40
|
-
export interface GrokVideoMetadata {
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Metadata for Grok document content parts.
|
|
44
|
-
* Note: Direct document support may vary; PDFs often need to be converted to images.
|
|
45
|
-
*/
|
|
46
|
-
export interface GrokDocumentMetadata {
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Metadata for Grok text content parts.
|
|
50
|
-
* Currently no specific metadata options for text in Grok.
|
|
51
|
-
*/
|
|
52
|
-
export interface GrokTextMetadata {
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Map of modality types to their Grok-specific metadata types.
|
|
56
|
-
* Used for type inference when constructing multimodal messages.
|
|
57
|
-
*/
|
|
58
|
-
export interface GrokMessageMetadataByModality {
|
|
59
|
-
text: GrokTextMetadata;
|
|
60
|
-
image: GrokImageMetadata;
|
|
61
|
-
audio: GrokAudioMetadata;
|
|
62
|
-
video: GrokVideoMetadata;
|
|
63
|
-
document: GrokDocumentMetadata;
|
|
64
|
-
}
|
package/dist/esm/model-meta.d.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { GrokBuildProviderOptions, GrokTextProviderOptions } from './text/text-provider-options.js';
|
|
2
|
-
export type GrokProviderToolKind = 'web_search' | 'x_search' | 'file_search' | 'mcp';
|
|
3
|
-
declare const GROK_4_3: {
|
|
4
|
-
readonly name: "grok-4.3";
|
|
5
|
-
readonly context_window: 1000000;
|
|
6
|
-
readonly supports: {
|
|
7
|
-
readonly input: ["text", "image"];
|
|
8
|
-
readonly output: ["text"];
|
|
9
|
-
readonly capabilities: ["reasoning", "structured_outputs", "tool_calling"];
|
|
10
|
-
readonly tools: readonly ["web_search", "x_search", "file_search", "mcp"];
|
|
11
|
-
};
|
|
12
|
-
readonly pricing: {
|
|
13
|
-
readonly input: {
|
|
14
|
-
readonly normal: 1.25;
|
|
15
|
-
readonly cached: 0.2;
|
|
16
|
-
};
|
|
17
|
-
readonly output: {
|
|
18
|
-
readonly normal: 2.5;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
declare const GROK_BUILD_0_1: {
|
|
23
|
-
readonly name: "grok-build-0.1";
|
|
24
|
-
readonly context_window: 256000;
|
|
25
|
-
readonly supports: {
|
|
26
|
-
readonly input: ["text", "image"];
|
|
27
|
-
readonly output: ["text"];
|
|
28
|
-
readonly capabilities: ["reasoning", "structured_outputs", "tool_calling"];
|
|
29
|
-
readonly tools: readonly ["web_search", "x_search", "file_search", "mcp"];
|
|
30
|
-
};
|
|
31
|
-
readonly pricing: {
|
|
32
|
-
readonly input: {
|
|
33
|
-
readonly normal: 1;
|
|
34
|
-
readonly cached: 0.2;
|
|
35
|
-
};
|
|
36
|
-
readonly output: {
|
|
37
|
-
readonly normal: 2;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Grok chat models supported by the Responses adapter.
|
|
43
|
-
*/
|
|
44
|
-
export declare const GROK_CHAT_MODELS: readonly ["grok-build-0.1", "grok-4.3"];
|
|
45
|
-
/**
|
|
46
|
-
* Grok Image Generation Models
|
|
47
|
-
*/
|
|
48
|
-
export declare const GROK_IMAGE_MODELS: readonly ["grok-2-image-1212", "grok-imagine-image", "grok-imagine-image-quality"];
|
|
49
|
-
/**
|
|
50
|
-
* Grok Video Generation Models (xAI Imagine API)
|
|
51
|
-
*
|
|
52
|
-
* @experimental Video generation is an experimental feature and may change.
|
|
53
|
-
*/
|
|
54
|
-
export declare const GROK_VIDEO_MODELS: readonly ["grok-imagine-video", "grok-imagine-video-1.5"];
|
|
55
|
-
export declare const GROK_TTS_MODELS: readonly ["grok-tts"];
|
|
56
|
-
export declare const GROK_TRANSCRIPTION_MODELS: readonly ["grok-stt"];
|
|
57
|
-
export declare const GROK_REALTIME_MODELS: readonly ["grok-voice-fast-1.0", "grok-voice-think-fast-1.0"];
|
|
58
|
-
export type GrokChatModel = (typeof GROK_CHAT_MODELS)[number];
|
|
59
|
-
export type GrokImageModel = (typeof GROK_IMAGE_MODELS)[number];
|
|
60
|
-
export type GrokVideoModel = (typeof GROK_VIDEO_MODELS)[number];
|
|
61
|
-
export type GrokTTSModel = (typeof GROK_TTS_MODELS)[number];
|
|
62
|
-
export type GrokTranscriptionModel = (typeof GROK_TRANSCRIPTION_MODELS)[number];
|
|
63
|
-
export type GrokRealtimeModel = (typeof GROK_REALTIME_MODELS)[number];
|
|
64
|
-
/**
|
|
65
|
-
* Type-only map from Grok chat model name to its supported input modalities.
|
|
66
|
-
* Used for type inference when constructing multimodal messages.
|
|
67
|
-
*/
|
|
68
|
-
export type GrokModelInputModalitiesByName = {
|
|
69
|
-
[GROK_4_3.name]: typeof GROK_4_3.supports.input;
|
|
70
|
-
[GROK_BUILD_0_1.name]: typeof GROK_BUILD_0_1.supports.input;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Type-only map from Grok chat model name to its supported provider tools.
|
|
74
|
-
* Keeps Grok provider-tool factories type-checked against the models that
|
|
75
|
-
* advertise xAI Responses server-side tools.
|
|
76
|
-
*/
|
|
77
|
-
export type GrokChatModelToolCapabilitiesByName = {
|
|
78
|
-
[GROK_4_3.name]: typeof GROK_4_3.supports.tools;
|
|
79
|
-
[GROK_BUILD_0_1.name]: typeof GROK_BUILD_0_1.supports.tools;
|
|
80
|
-
};
|
|
81
|
-
export type GrokProviderOptions = GrokTextProviderOptions;
|
|
82
|
-
/**
|
|
83
|
-
* Type-only map from Grok chat model name to its provider options type.
|
|
84
|
-
*/
|
|
85
|
-
export type GrokChatModelProviderOptionsByName = {
|
|
86
|
-
[GROK_4_3.name]: GrokProviderOptions;
|
|
87
|
-
[GROK_BUILD_0_1.name]: GrokBuildProviderOptions;
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Resolve provider options for a specific model.
|
|
91
|
-
* If the model has explicit options in the map, use those; otherwise use base options.
|
|
92
|
-
*/
|
|
93
|
-
export type ResolveProviderOptions<TModel extends string> = TModel extends keyof GrokChatModelProviderOptionsByName ? GrokChatModelProviderOptionsByName[TModel] : GrokProviderOptions;
|
|
94
|
-
/**
|
|
95
|
-
* Resolve input modalities for a specific model.
|
|
96
|
-
* If the model has explicit modalities in the map, use those; otherwise use text only.
|
|
97
|
-
*/
|
|
98
|
-
export type ResolveInputModalities<TModel extends string> = TModel extends keyof GrokModelInputModalitiesByName ? GrokModelInputModalitiesByName[TModel] : readonly ['text'];
|
|
99
|
-
export {};
|
package/dist/esm/model-meta.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
const GROK_2_IMAGE = {
|
|
2
|
-
name: "grok-2-image-1212"
|
|
3
|
-
};
|
|
4
|
-
const GROK_IMAGINE_IMAGE = {
|
|
5
|
-
name: "grok-imagine-image"
|
|
6
|
-
};
|
|
7
|
-
const GROK_IMAGINE_IMAGE_QUALITY = {
|
|
8
|
-
name: "grok-imagine-image-quality"
|
|
9
|
-
};
|
|
10
|
-
const GROK_IMAGINE_VIDEO = {
|
|
11
|
-
name: "grok-imagine-video"
|
|
12
|
-
};
|
|
13
|
-
const GROK_IMAGINE_VIDEO_1_5 = {
|
|
14
|
-
name: "grok-imagine-video-1.5"
|
|
15
|
-
};
|
|
16
|
-
const GROK_4_3 = {
|
|
17
|
-
name: "grok-4.3"
|
|
18
|
-
};
|
|
19
|
-
const GROK_BUILD_0_1 = {
|
|
20
|
-
name: "grok-build-0.1"
|
|
21
|
-
};
|
|
22
|
-
const GROK_CHAT_MODELS = [GROK_BUILD_0_1.name, GROK_4_3.name];
|
|
23
|
-
const GROK_IMAGE_MODELS = [
|
|
24
|
-
GROK_2_IMAGE.name,
|
|
25
|
-
GROK_IMAGINE_IMAGE.name,
|
|
26
|
-
GROK_IMAGINE_IMAGE_QUALITY.name
|
|
27
|
-
];
|
|
28
|
-
const GROK_VIDEO_MODELS = [
|
|
29
|
-
GROK_IMAGINE_VIDEO.name,
|
|
30
|
-
GROK_IMAGINE_VIDEO_1_5.name
|
|
31
|
-
];
|
|
32
|
-
const GROK_TTS = {
|
|
33
|
-
name: "grok-tts"
|
|
34
|
-
};
|
|
35
|
-
const GROK_STT = {
|
|
36
|
-
name: "grok-stt"
|
|
37
|
-
};
|
|
38
|
-
const GROK_VOICE_FAST_1 = {
|
|
39
|
-
name: "grok-voice-fast-1.0"
|
|
40
|
-
};
|
|
41
|
-
const GROK_VOICE_THINK_FAST_1 = {
|
|
42
|
-
name: "grok-voice-think-fast-1.0"
|
|
43
|
-
};
|
|
44
|
-
const GROK_TTS_MODELS = [GROK_TTS.name];
|
|
45
|
-
const GROK_TRANSCRIPTION_MODELS = [GROK_STT.name];
|
|
46
|
-
const GROK_REALTIME_MODELS = [
|
|
47
|
-
GROK_VOICE_FAST_1.name,
|
|
48
|
-
GROK_VOICE_THINK_FAST_1.name
|
|
49
|
-
];
|
|
50
|
-
export {
|
|
51
|
-
GROK_CHAT_MODELS,
|
|
52
|
-
GROK_IMAGE_MODELS,
|
|
53
|
-
GROK_REALTIME_MODELS,
|
|
54
|
-
GROK_TRANSCRIPTION_MODELS,
|
|
55
|
-
GROK_TTS_MODELS,
|
|
56
|
-
GROK_VIDEO_MODELS
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=model-meta.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model-meta.js","sources":["../../src/model-meta.ts"],"sourcesContent":["/**\n * Model metadata interface for documentation and type inference\n */\nimport type {\n GrokBuildProviderOptions,\n GrokTextProviderOptions,\n} from './text/text-provider-options'\n\ninterface ModelMeta {\n name: string\n supports: {\n input: Array<'text' | 'image' | 'audio' | 'video' | 'document'>\n output: Array<'text' | 'image' | 'audio' | 'video'>\n capabilities?: Array<'reasoning' | 'tool_calling' | 'structured_outputs'>\n tools?: ReadonlyArray<GrokProviderToolKind>\n }\n max_input_tokens?: number\n max_output_tokens?: number\n context_window?: number\n knowledge_cutoff?: string\n pricing?: {\n input: {\n normal: number\n cached?: number\n }\n output: {\n normal: number\n }\n }\n}\n\nexport type GrokProviderToolKind =\n | 'web_search'\n | 'x_search'\n | 'file_search'\n | 'mcp'\n\nconst GROK_RESPONSES_TOOLS = [\n 'web_search',\n 'x_search',\n 'file_search',\n 'mcp',\n] as const satisfies ReadonlyArray<GrokProviderToolKind>\n\nconst GROK_2_IMAGE = {\n name: 'grok-2-image-1212',\n supports: {\n input: ['text'],\n output: ['image'],\n },\n pricing: {\n input: {\n normal: 0.07,\n },\n output: {\n normal: 0.07,\n },\n },\n} as const satisfies ModelMeta\n\n// Imagine API image models. Pricing is per generated image (output only).\nconst GROK_IMAGINE_IMAGE = {\n name: 'grok-imagine-image',\n supports: {\n input: ['text', 'image'],\n output: ['image'],\n },\n pricing: {\n input: {\n normal: 0,\n },\n output: {\n normal: 0.02,\n },\n },\n} as const satisfies ModelMeta\n\nconst GROK_IMAGINE_IMAGE_QUALITY = {\n name: 'grok-imagine-image-quality',\n supports: {\n input: ['text', 'image'],\n output: ['image'],\n },\n pricing: {\n input: {\n normal: 0,\n },\n output: {\n normal: 0.05,\n },\n },\n} as const satisfies ModelMeta\n\n// Imagine API video models. Pricing is per second of generated video\n// (output only); generated videos carry an audio track.\n//\n// grok-imagine-video (v1.0) supports both text-to-video (a starting image is\n// optional) and image-to-video. grok-imagine-video-1.5 is image-to-video\n// only: a starting-frame image is required (the text prompt describes the\n// desired motion) — its text-to-video is rejected by the API.\nconst GROK_IMAGINE_VIDEO = {\n name: 'grok-imagine-video',\n supports: {\n input: ['text', 'image'],\n output: ['video', 'audio'],\n },\n pricing: {\n input: {\n normal: 0,\n },\n output: {\n // per second of video\n normal: 0.05,\n },\n },\n} as const satisfies ModelMeta\n\nconst GROK_IMAGINE_VIDEO_1_5 = {\n name: 'grok-imagine-video-1.5',\n supports: {\n input: ['text', 'image'],\n output: ['video', 'audio'],\n },\n pricing: {\n input: {\n normal: 0,\n },\n output: {\n // per second of video\n normal: 0.08,\n },\n },\n} as const satisfies ModelMeta\n\nconst GROK_4_3 = {\n name: 'grok-4.3',\n context_window: 1_000_000,\n supports: {\n input: ['text', 'image'],\n output: ['text'],\n capabilities: ['reasoning', 'structured_outputs', 'tool_calling'],\n tools: GROK_RESPONSES_TOOLS,\n },\n pricing: {\n input: {\n normal: 1.25,\n cached: 0.2,\n },\n output: {\n normal: 2.5,\n },\n },\n} as const satisfies ModelMeta\n\nconst GROK_BUILD_0_1 = {\n name: 'grok-build-0.1',\n context_window: 256_000,\n supports: {\n input: ['text', 'image'],\n output: ['text'],\n capabilities: ['reasoning', 'structured_outputs', 'tool_calling'],\n tools: GROK_RESPONSES_TOOLS,\n },\n pricing: {\n input: {\n normal: 1,\n cached: 0.2,\n },\n output: {\n normal: 2,\n },\n },\n} as const satisfies ModelMeta\n\n/**\n * Grok chat models supported by the Responses adapter.\n */\nexport const GROK_CHAT_MODELS = [GROK_BUILD_0_1.name, GROK_4_3.name] as const\n\n/**\n * Grok Image Generation Models\n */\nexport const GROK_IMAGE_MODELS = [\n GROK_2_IMAGE.name,\n GROK_IMAGINE_IMAGE.name,\n GROK_IMAGINE_IMAGE_QUALITY.name,\n] as const\n\n/**\n * Grok Video Generation Models (xAI Imagine API)\n *\n * @experimental Video generation is an experimental feature and may change.\n */\nexport const GROK_VIDEO_MODELS = [\n GROK_IMAGINE_VIDEO.name,\n GROK_IMAGINE_VIDEO_1_5.name,\n] as const\n\n// xAI's `/v1/tts` endpoint is endpoint-addressed and does not take a `model`\n// parameter. This synthetic identifier satisfies the SDK's `TTSOptions.model`\n// contract and provides a stable value for logging and fixture matching.\nconst GROK_TTS = {\n name: 'grok-tts',\n supports: {\n input: ['text'],\n output: ['audio'],\n },\n} as const satisfies ModelMeta\n\n// xAI's `/v1/stt` endpoint is endpoint-addressed and does not take a `model`\n// parameter. This synthetic identifier satisfies the SDK's\n// `TranscriptionOptions.model` contract.\nconst GROK_STT = {\n name: 'grok-stt',\n supports: {\n input: ['audio'],\n output: ['text'],\n },\n} as const satisfies ModelMeta\n\nconst GROK_VOICE_FAST_1 = {\n name: 'grok-voice-fast-1.0',\n supports: {\n input: ['audio', 'text'],\n output: ['audio', 'text'],\n capabilities: ['tool_calling'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta\n\nconst GROK_VOICE_THINK_FAST_1 = {\n name: 'grok-voice-think-fast-1.0',\n supports: {\n input: ['audio', 'text'],\n output: ['audio', 'text'],\n capabilities: ['reasoning', 'tool_calling'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta\n\nexport const GROK_TTS_MODELS = [GROK_TTS.name] as const\n\nexport const GROK_TRANSCRIPTION_MODELS = [GROK_STT.name] as const\n\nexport const GROK_REALTIME_MODELS = [\n GROK_VOICE_FAST_1.name,\n GROK_VOICE_THINK_FAST_1.name,\n] as const\n\nexport type GrokChatModel = (typeof GROK_CHAT_MODELS)[number]\nexport type GrokImageModel = (typeof GROK_IMAGE_MODELS)[number]\nexport type GrokVideoModel = (typeof GROK_VIDEO_MODELS)[number]\nexport type GrokTTSModel = (typeof GROK_TTS_MODELS)[number]\nexport type GrokTranscriptionModel = (typeof GROK_TRANSCRIPTION_MODELS)[number]\nexport type GrokRealtimeModel = (typeof GROK_REALTIME_MODELS)[number]\n\n/**\n * Type-only map from Grok chat model name to its supported input modalities.\n * Used for type inference when constructing multimodal messages.\n */\nexport type GrokModelInputModalitiesByName = {\n [GROK_4_3.name]: typeof GROK_4_3.supports.input\n [GROK_BUILD_0_1.name]: typeof GROK_BUILD_0_1.supports.input\n}\n\n/**\n * Type-only map from Grok chat model name to its supported provider tools.\n * Keeps Grok provider-tool factories type-checked against the models that\n * advertise xAI Responses server-side tools.\n */\nexport type GrokChatModelToolCapabilitiesByName = {\n [GROK_4_3.name]: typeof GROK_4_3.supports.tools\n [GROK_BUILD_0_1.name]: typeof GROK_BUILD_0_1.supports.tools\n}\n\nexport type GrokProviderOptions = GrokTextProviderOptions\n\n/**\n * Type-only map from Grok chat model name to its provider options type.\n */\nexport type GrokChatModelProviderOptionsByName = {\n [GROK_4_3.name]: GrokProviderOptions\n [GROK_BUILD_0_1.name]: GrokBuildProviderOptions\n}\n\n// ===========================\n// Type Resolution Helpers\n// ===========================\n\n/**\n * Resolve provider options for a specific model.\n * If the model has explicit options in the map, use those; otherwise use base options.\n */\nexport type ResolveProviderOptions<TModel extends string> =\n TModel extends keyof GrokChatModelProviderOptionsByName\n ? GrokChatModelProviderOptionsByName[TModel]\n : GrokProviderOptions\n\n/**\n * Resolve input modalities for a specific model.\n * If the model has explicit modalities in the map, use those; otherwise use text only.\n */\nexport type ResolveInputModalities<TModel extends string> =\n TModel extends keyof GrokModelInputModalitiesByName\n ? GrokModelInputModalitiesByName[TModel]\n : readonly ['text']\n"],"names":[],"mappings":"AA4CA,MAAM,eAAe;AAAA,EACnB,MAAM;AAaR;AAGA,MAAM,qBAAqB;AAAA,EACzB,MAAM;AAaR;AAEA,MAAM,6BAA6B;AAAA,EACjC,MAAM;AAaR;AASA,MAAM,qBAAqB;AAAA,EACzB,MAAM;AAcR;AAEA,MAAM,yBAAyB;AAAA,EAC7B,MAAM;AAcR;AAEA,MAAM,WAAW;AAAA,EACf,MAAM;AAiBR;AAEA,MAAM,iBAAiB;AAAA,EACrB,MAAM;AAiBR;AAKO,MAAM,mBAAmB,CAAC,eAAe,MAAM,SAAS,IAAI;AAK5D,MAAM,oBAAoB;AAAA,EAC/B,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,2BAA2B;AAC7B;AAOO,MAAM,oBAAoB;AAAA,EAC/B,mBAAmB;AAAA,EACnB,uBAAuB;AACzB;AAKA,MAAM,WAAW;AAAA,EACf,MAAM;AAKR;AAKA,MAAM,WAAW;AAAA,EACf,MAAM;AAKR;AAEA,MAAM,oBAAoB;AAAA,EACxB,MAAM;AAOR;AAEA,MAAM,0BAA0B;AAAA,EAC9B,MAAM;AAOR;AAEO,MAAM,kBAAkB,CAAC,SAAS,IAAI;AAEtC,MAAM,4BAA4B,CAAC,SAAS,IAAI;AAEhD,MAAM,uBAAuB;AAAA,EAClC,kBAAkB;AAAA,EAClB,wBAAwB;AAC1B;"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { RealtimeAdapter } from '@tanstack/ai';
|
|
2
|
-
import { GrokRealtimeOptions } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Creates a Grok realtime adapter for client-side use.
|
|
5
|
-
*
|
|
6
|
-
* Uses WebRTC for browser connections (default). Mirrors the OpenAI realtime
|
|
7
|
-
* adapter because xAI's Voice Agent API is OpenAI-realtime-compatible — the
|
|
8
|
-
* only differences are the endpoint URL and default model.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* import { RealtimeClient } from '@tanstack/ai-client'
|
|
13
|
-
* import { grokRealtime } from '@tanstack/ai-grok'
|
|
14
|
-
*
|
|
15
|
-
* const client = new RealtimeClient({
|
|
16
|
-
* getToken: () => fetch('/api/realtime-token').then(r => r.json()),
|
|
17
|
-
* adapter: grokRealtime(),
|
|
18
|
-
* })
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare function grokRealtime(options?: GrokRealtimeOptions): RealtimeAdapter;
|