@yourgpt/llm-sdk 2.1.7 → 2.1.9
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/dist/adapters/index.js +38 -0
- package/dist/adapters/index.mjs +38 -0
- package/dist/providers/azure/index.js +11 -0
- package/dist/providers/azure/index.mjs +11 -0
- package/dist/providers/google/index.js +11 -0
- package/dist/providers/google/index.mjs +11 -0
- package/dist/providers/ollama/index.js +5 -0
- package/dist/providers/ollama/index.mjs +5 -0
- package/dist/providers/openai/index.js +11 -0
- package/dist/providers/openai/index.mjs +11 -0
- package/dist/providers/openrouter/index.js +11 -0
- package/dist/providers/openrouter/index.mjs +11 -0
- package/dist/providers/togetherai/index.d.mts +112 -0
- package/dist/providers/togetherai/index.d.ts +112 -0
- package/dist/providers/togetherai/index.js +930 -0
- package/dist/providers/togetherai/index.mjs +926 -0
- package/dist/providers/xai/index.js +11 -0
- package/dist/providers/xai/index.mjs +11 -0
- package/package.json +8 -1
package/dist/adapters/index.js
CHANGED
|
@@ -667,6 +667,11 @@ var OpenAIAdapter = class _OpenAIAdapter {
|
|
|
667
667
|
id: currentToolCall.id,
|
|
668
668
|
args: currentToolCall.arguments
|
|
669
669
|
};
|
|
670
|
+
yield {
|
|
671
|
+
type: "action:end",
|
|
672
|
+
id: currentToolCall.id,
|
|
673
|
+
name: currentToolCall.name
|
|
674
|
+
};
|
|
670
675
|
}
|
|
671
676
|
const tcExtraContent = toolCall.extra_content;
|
|
672
677
|
currentToolCall = {
|
|
@@ -700,6 +705,12 @@ var OpenAIAdapter = class _OpenAIAdapter {
|
|
|
700
705
|
id: currentToolCall.id,
|
|
701
706
|
args: currentToolCall.arguments
|
|
702
707
|
};
|
|
708
|
+
yield {
|
|
709
|
+
type: "action:end",
|
|
710
|
+
id: currentToolCall.id,
|
|
711
|
+
name: currentToolCall.name
|
|
712
|
+
};
|
|
713
|
+
currentToolCall = null;
|
|
703
714
|
}
|
|
704
715
|
}
|
|
705
716
|
}
|
|
@@ -1537,6 +1548,11 @@ var OllamaAdapter = class {
|
|
|
1537
1548
|
id: toolCallId,
|
|
1538
1549
|
args: JSON.stringify(toolCall.function?.arguments || {})
|
|
1539
1550
|
};
|
|
1551
|
+
yield {
|
|
1552
|
+
type: "action:end",
|
|
1553
|
+
id: toolCallId,
|
|
1554
|
+
name: toolCall.function?.name || ""
|
|
1555
|
+
};
|
|
1540
1556
|
}
|
|
1541
1557
|
hasEmittedToolCalls = true;
|
|
1542
1558
|
}
|
|
@@ -1818,6 +1834,11 @@ var GoogleAdapter = class {
|
|
|
1818
1834
|
id: currentToolCall.id,
|
|
1819
1835
|
args: JSON.stringify(currentToolCall.args)
|
|
1820
1836
|
};
|
|
1837
|
+
yield {
|
|
1838
|
+
type: "action:end",
|
|
1839
|
+
id: currentToolCall.id,
|
|
1840
|
+
name: currentToolCall.name
|
|
1841
|
+
};
|
|
1821
1842
|
}
|
|
1822
1843
|
currentToolCall = {
|
|
1823
1844
|
id: toolId,
|
|
@@ -1838,6 +1859,12 @@ var GoogleAdapter = class {
|
|
|
1838
1859
|
id: currentToolCall.id,
|
|
1839
1860
|
args: JSON.stringify(currentToolCall.args)
|
|
1840
1861
|
};
|
|
1862
|
+
yield {
|
|
1863
|
+
type: "action:end",
|
|
1864
|
+
id: currentToolCall.id,
|
|
1865
|
+
name: currentToolCall.name
|
|
1866
|
+
};
|
|
1867
|
+
currentToolCall = null;
|
|
1841
1868
|
}
|
|
1842
1869
|
}
|
|
1843
1870
|
const groundingMetadata = candidate?.groundingMetadata;
|
|
@@ -2127,6 +2154,11 @@ var AzureAdapter = class {
|
|
|
2127
2154
|
id: currentToolCall.id,
|
|
2128
2155
|
args: currentToolCall.arguments
|
|
2129
2156
|
};
|
|
2157
|
+
yield {
|
|
2158
|
+
type: "action:end",
|
|
2159
|
+
id: currentToolCall.id,
|
|
2160
|
+
name: currentToolCall.name
|
|
2161
|
+
};
|
|
2130
2162
|
}
|
|
2131
2163
|
currentToolCall = {
|
|
2132
2164
|
id: toolCall.id,
|
|
@@ -2150,6 +2182,12 @@ var AzureAdapter = class {
|
|
|
2150
2182
|
id: currentToolCall.id,
|
|
2151
2183
|
args: currentToolCall.arguments
|
|
2152
2184
|
};
|
|
2185
|
+
yield {
|
|
2186
|
+
type: "action:end",
|
|
2187
|
+
id: currentToolCall.id,
|
|
2188
|
+
name: currentToolCall.name
|
|
2189
|
+
};
|
|
2190
|
+
currentToolCall = null;
|
|
2153
2191
|
}
|
|
2154
2192
|
}
|
|
2155
2193
|
}
|
package/dist/adapters/index.mjs
CHANGED
|
@@ -665,6 +665,11 @@ var OpenAIAdapter = class _OpenAIAdapter {
|
|
|
665
665
|
id: currentToolCall.id,
|
|
666
666
|
args: currentToolCall.arguments
|
|
667
667
|
};
|
|
668
|
+
yield {
|
|
669
|
+
type: "action:end",
|
|
670
|
+
id: currentToolCall.id,
|
|
671
|
+
name: currentToolCall.name
|
|
672
|
+
};
|
|
668
673
|
}
|
|
669
674
|
const tcExtraContent = toolCall.extra_content;
|
|
670
675
|
currentToolCall = {
|
|
@@ -698,6 +703,12 @@ var OpenAIAdapter = class _OpenAIAdapter {
|
|
|
698
703
|
id: currentToolCall.id,
|
|
699
704
|
args: currentToolCall.arguments
|
|
700
705
|
};
|
|
706
|
+
yield {
|
|
707
|
+
type: "action:end",
|
|
708
|
+
id: currentToolCall.id,
|
|
709
|
+
name: currentToolCall.name
|
|
710
|
+
};
|
|
711
|
+
currentToolCall = null;
|
|
701
712
|
}
|
|
702
713
|
}
|
|
703
714
|
}
|
|
@@ -1535,6 +1546,11 @@ var OllamaAdapter = class {
|
|
|
1535
1546
|
id: toolCallId,
|
|
1536
1547
|
args: JSON.stringify(toolCall.function?.arguments || {})
|
|
1537
1548
|
};
|
|
1549
|
+
yield {
|
|
1550
|
+
type: "action:end",
|
|
1551
|
+
id: toolCallId,
|
|
1552
|
+
name: toolCall.function?.name || ""
|
|
1553
|
+
};
|
|
1538
1554
|
}
|
|
1539
1555
|
hasEmittedToolCalls = true;
|
|
1540
1556
|
}
|
|
@@ -1816,6 +1832,11 @@ var GoogleAdapter = class {
|
|
|
1816
1832
|
id: currentToolCall.id,
|
|
1817
1833
|
args: JSON.stringify(currentToolCall.args)
|
|
1818
1834
|
};
|
|
1835
|
+
yield {
|
|
1836
|
+
type: "action:end",
|
|
1837
|
+
id: currentToolCall.id,
|
|
1838
|
+
name: currentToolCall.name
|
|
1839
|
+
};
|
|
1819
1840
|
}
|
|
1820
1841
|
currentToolCall = {
|
|
1821
1842
|
id: toolId,
|
|
@@ -1836,6 +1857,12 @@ var GoogleAdapter = class {
|
|
|
1836
1857
|
id: currentToolCall.id,
|
|
1837
1858
|
args: JSON.stringify(currentToolCall.args)
|
|
1838
1859
|
};
|
|
1860
|
+
yield {
|
|
1861
|
+
type: "action:end",
|
|
1862
|
+
id: currentToolCall.id,
|
|
1863
|
+
name: currentToolCall.name
|
|
1864
|
+
};
|
|
1865
|
+
currentToolCall = null;
|
|
1839
1866
|
}
|
|
1840
1867
|
}
|
|
1841
1868
|
const groundingMetadata = candidate?.groundingMetadata;
|
|
@@ -2125,6 +2152,11 @@ var AzureAdapter = class {
|
|
|
2125
2152
|
id: currentToolCall.id,
|
|
2126
2153
|
args: currentToolCall.arguments
|
|
2127
2154
|
};
|
|
2155
|
+
yield {
|
|
2156
|
+
type: "action:end",
|
|
2157
|
+
id: currentToolCall.id,
|
|
2158
|
+
name: currentToolCall.name
|
|
2159
|
+
};
|
|
2128
2160
|
}
|
|
2129
2161
|
currentToolCall = {
|
|
2130
2162
|
id: toolCall.id,
|
|
@@ -2148,6 +2180,12 @@ var AzureAdapter = class {
|
|
|
2148
2180
|
id: currentToolCall.id,
|
|
2149
2181
|
args: currentToolCall.arguments
|
|
2150
2182
|
};
|
|
2183
|
+
yield {
|
|
2184
|
+
type: "action:end",
|
|
2185
|
+
id: currentToolCall.id,
|
|
2186
|
+
name: currentToolCall.name
|
|
2187
|
+
};
|
|
2188
|
+
currentToolCall = null;
|
|
2151
2189
|
}
|
|
2152
2190
|
}
|
|
2153
2191
|
}
|
|
@@ -279,6 +279,11 @@ var AzureAdapter = class {
|
|
|
279
279
|
id: currentToolCall.id,
|
|
280
280
|
args: currentToolCall.arguments
|
|
281
281
|
};
|
|
282
|
+
yield {
|
|
283
|
+
type: "action:end",
|
|
284
|
+
id: currentToolCall.id,
|
|
285
|
+
name: currentToolCall.name
|
|
286
|
+
};
|
|
282
287
|
}
|
|
283
288
|
currentToolCall = {
|
|
284
289
|
id: toolCall.id,
|
|
@@ -302,6 +307,12 @@ var AzureAdapter = class {
|
|
|
302
307
|
id: currentToolCall.id,
|
|
303
308
|
args: currentToolCall.arguments
|
|
304
309
|
};
|
|
310
|
+
yield {
|
|
311
|
+
type: "action:end",
|
|
312
|
+
id: currentToolCall.id,
|
|
313
|
+
name: currentToolCall.name
|
|
314
|
+
};
|
|
315
|
+
currentToolCall = null;
|
|
305
316
|
}
|
|
306
317
|
}
|
|
307
318
|
}
|
|
@@ -277,6 +277,11 @@ var AzureAdapter = class {
|
|
|
277
277
|
id: currentToolCall.id,
|
|
278
278
|
args: currentToolCall.arguments
|
|
279
279
|
};
|
|
280
|
+
yield {
|
|
281
|
+
type: "action:end",
|
|
282
|
+
id: currentToolCall.id,
|
|
283
|
+
name: currentToolCall.name
|
|
284
|
+
};
|
|
280
285
|
}
|
|
281
286
|
currentToolCall = {
|
|
282
287
|
id: toolCall.id,
|
|
@@ -300,6 +305,12 @@ var AzureAdapter = class {
|
|
|
300
305
|
id: currentToolCall.id,
|
|
301
306
|
args: currentToolCall.arguments
|
|
302
307
|
};
|
|
308
|
+
yield {
|
|
309
|
+
type: "action:end",
|
|
310
|
+
id: currentToolCall.id,
|
|
311
|
+
name: currentToolCall.name
|
|
312
|
+
};
|
|
313
|
+
currentToolCall = null;
|
|
303
314
|
}
|
|
304
315
|
}
|
|
305
316
|
}
|
|
@@ -791,6 +791,11 @@ var OpenAIAdapter = class _OpenAIAdapter {
|
|
|
791
791
|
id: currentToolCall.id,
|
|
792
792
|
args: currentToolCall.arguments
|
|
793
793
|
};
|
|
794
|
+
yield {
|
|
795
|
+
type: "action:end",
|
|
796
|
+
id: currentToolCall.id,
|
|
797
|
+
name: currentToolCall.name
|
|
798
|
+
};
|
|
794
799
|
}
|
|
795
800
|
const tcExtraContent = toolCall.extra_content;
|
|
796
801
|
currentToolCall = {
|
|
@@ -824,6 +829,12 @@ var OpenAIAdapter = class _OpenAIAdapter {
|
|
|
824
829
|
id: currentToolCall.id,
|
|
825
830
|
args: currentToolCall.arguments
|
|
826
831
|
};
|
|
832
|
+
yield {
|
|
833
|
+
type: "action:end",
|
|
834
|
+
id: currentToolCall.id,
|
|
835
|
+
name: currentToolCall.name
|
|
836
|
+
};
|
|
837
|
+
currentToolCall = null;
|
|
827
838
|
}
|
|
828
839
|
}
|
|
829
840
|
}
|
|
@@ -789,6 +789,11 @@ var OpenAIAdapter = class _OpenAIAdapter {
|
|
|
789
789
|
id: currentToolCall.id,
|
|
790
790
|
args: currentToolCall.arguments
|
|
791
791
|
};
|
|
792
|
+
yield {
|
|
793
|
+
type: "action:end",
|
|
794
|
+
id: currentToolCall.id,
|
|
795
|
+
name: currentToolCall.name
|
|
796
|
+
};
|
|
792
797
|
}
|
|
793
798
|
const tcExtraContent = toolCall.extra_content;
|
|
794
799
|
currentToolCall = {
|
|
@@ -822,6 +827,12 @@ var OpenAIAdapter = class _OpenAIAdapter {
|
|
|
822
827
|
id: currentToolCall.id,
|
|
823
828
|
args: currentToolCall.arguments
|
|
824
829
|
};
|
|
830
|
+
yield {
|
|
831
|
+
type: "action:end",
|
|
832
|
+
id: currentToolCall.id,
|
|
833
|
+
name: currentToolCall.name
|
|
834
|
+
};
|
|
835
|
+
currentToolCall = null;
|
|
825
836
|
}
|
|
826
837
|
}
|
|
827
838
|
}
|
|
@@ -301,6 +301,11 @@ var OllamaAdapter = class {
|
|
|
301
301
|
id: toolCallId,
|
|
302
302
|
args: JSON.stringify(toolCall.function?.arguments || {})
|
|
303
303
|
};
|
|
304
|
+
yield {
|
|
305
|
+
type: "action:end",
|
|
306
|
+
id: toolCallId,
|
|
307
|
+
name: toolCall.function?.name || ""
|
|
308
|
+
};
|
|
304
309
|
}
|
|
305
310
|
hasEmittedToolCalls = true;
|
|
306
311
|
}
|
|
@@ -299,6 +299,11 @@ var OllamaAdapter = class {
|
|
|
299
299
|
id: toolCallId,
|
|
300
300
|
args: JSON.stringify(toolCall.function?.arguments || {})
|
|
301
301
|
};
|
|
302
|
+
yield {
|
|
303
|
+
type: "action:end",
|
|
304
|
+
id: toolCallId,
|
|
305
|
+
name: toolCall.function?.name || ""
|
|
306
|
+
};
|
|
302
307
|
}
|
|
303
308
|
hasEmittedToolCalls = true;
|
|
304
309
|
}
|
|
@@ -772,6 +772,11 @@ var OpenAIAdapter = class _OpenAIAdapter {
|
|
|
772
772
|
id: currentToolCall.id,
|
|
773
773
|
args: currentToolCall.arguments
|
|
774
774
|
};
|
|
775
|
+
yield {
|
|
776
|
+
type: "action:end",
|
|
777
|
+
id: currentToolCall.id,
|
|
778
|
+
name: currentToolCall.name
|
|
779
|
+
};
|
|
775
780
|
}
|
|
776
781
|
const tcExtraContent = toolCall.extra_content;
|
|
777
782
|
currentToolCall = {
|
|
@@ -805,6 +810,12 @@ var OpenAIAdapter = class _OpenAIAdapter {
|
|
|
805
810
|
id: currentToolCall.id,
|
|
806
811
|
args: currentToolCall.arguments
|
|
807
812
|
};
|
|
813
|
+
yield {
|
|
814
|
+
type: "action:end",
|
|
815
|
+
id: currentToolCall.id,
|
|
816
|
+
name: currentToolCall.name
|
|
817
|
+
};
|
|
818
|
+
currentToolCall = null;
|
|
808
819
|
}
|
|
809
820
|
}
|
|
810
821
|
}
|
|
@@ -770,6 +770,11 @@ var OpenAIAdapter = class _OpenAIAdapter {
|
|
|
770
770
|
id: currentToolCall.id,
|
|
771
771
|
args: currentToolCall.arguments
|
|
772
772
|
};
|
|
773
|
+
yield {
|
|
774
|
+
type: "action:end",
|
|
775
|
+
id: currentToolCall.id,
|
|
776
|
+
name: currentToolCall.name
|
|
777
|
+
};
|
|
773
778
|
}
|
|
774
779
|
const tcExtraContent = toolCall.extra_content;
|
|
775
780
|
currentToolCall = {
|
|
@@ -803,6 +808,12 @@ var OpenAIAdapter = class _OpenAIAdapter {
|
|
|
803
808
|
id: currentToolCall.id,
|
|
804
809
|
args: currentToolCall.arguments
|
|
805
810
|
};
|
|
811
|
+
yield {
|
|
812
|
+
type: "action:end",
|
|
813
|
+
id: currentToolCall.id,
|
|
814
|
+
name: currentToolCall.name
|
|
815
|
+
};
|
|
816
|
+
currentToolCall = null;
|
|
806
817
|
}
|
|
807
818
|
}
|
|
808
819
|
}
|
|
@@ -758,6 +758,11 @@ var OpenAIAdapter = class _OpenAIAdapter {
|
|
|
758
758
|
id: currentToolCall.id,
|
|
759
759
|
args: currentToolCall.arguments
|
|
760
760
|
};
|
|
761
|
+
yield {
|
|
762
|
+
type: "action:end",
|
|
763
|
+
id: currentToolCall.id,
|
|
764
|
+
name: currentToolCall.name
|
|
765
|
+
};
|
|
761
766
|
}
|
|
762
767
|
const tcExtraContent = toolCall.extra_content;
|
|
763
768
|
currentToolCall = {
|
|
@@ -791,6 +796,12 @@ var OpenAIAdapter = class _OpenAIAdapter {
|
|
|
791
796
|
id: currentToolCall.id,
|
|
792
797
|
args: currentToolCall.arguments
|
|
793
798
|
};
|
|
799
|
+
yield {
|
|
800
|
+
type: "action:end",
|
|
801
|
+
id: currentToolCall.id,
|
|
802
|
+
name: currentToolCall.name
|
|
803
|
+
};
|
|
804
|
+
currentToolCall = null;
|
|
794
805
|
}
|
|
795
806
|
}
|
|
796
807
|
}
|
|
@@ -756,6 +756,11 @@ var OpenAIAdapter = class _OpenAIAdapter {
|
|
|
756
756
|
id: currentToolCall.id,
|
|
757
757
|
args: currentToolCall.arguments
|
|
758
758
|
};
|
|
759
|
+
yield {
|
|
760
|
+
type: "action:end",
|
|
761
|
+
id: currentToolCall.id,
|
|
762
|
+
name: currentToolCall.name
|
|
763
|
+
};
|
|
759
764
|
}
|
|
760
765
|
const tcExtraContent = toolCall.extra_content;
|
|
761
766
|
currentToolCall = {
|
|
@@ -789,6 +794,12 @@ var OpenAIAdapter = class _OpenAIAdapter {
|
|
|
789
794
|
id: currentToolCall.id,
|
|
790
795
|
args: currentToolCall.arguments
|
|
791
796
|
};
|
|
797
|
+
yield {
|
|
798
|
+
type: "action:end",
|
|
799
|
+
id: currentToolCall.id,
|
|
800
|
+
name: currentToolCall.name
|
|
801
|
+
};
|
|
802
|
+
currentToolCall = null;
|
|
792
803
|
}
|
|
793
804
|
}
|
|
794
805
|
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { L as LanguageModel } from '../../types-CR8mi9I0.mjs';
|
|
2
|
+
import { A as AIProvider } from '../../types-DRqxMIjF.mjs';
|
|
3
|
+
import 'zod';
|
|
4
|
+
import '../../base-D-U61JaB.mjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Together AI Provider
|
|
8
|
+
*
|
|
9
|
+
* Together AI is a high-performance inference platform for open-source models
|
|
10
|
+
* (Llama, DeepSeek, Qwen, Mistral, Gemma, and more).
|
|
11
|
+
*
|
|
12
|
+
* It uses an OpenAI-compatible REST API.
|
|
13
|
+
*
|
|
14
|
+
* @see https://docs.together.ai/reference
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { togetherai } from '@yourgpt/llm-sdk/togetherai';
|
|
19
|
+
* import { generateText } from '@yourgpt/llm-sdk';
|
|
20
|
+
*
|
|
21
|
+
* const result = await generateText({
|
|
22
|
+
* model: togetherai('meta-llama/Llama-3.3-70B-Instruct-Turbo'),
|
|
23
|
+
* prompt: 'Hello!',
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
interface TogetherAIProviderOptions {
|
|
29
|
+
/** API key (defaults to TOGETHER_API_KEY env var) */
|
|
30
|
+
apiKey?: string;
|
|
31
|
+
/** Base URL for API (defaults to https://api.together.xyz/v1) */
|
|
32
|
+
baseURL?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create a Together AI language model.
|
|
36
|
+
*
|
|
37
|
+
* Model IDs follow the format `org/model-name` (e.g. 'meta-llama/Llama-3.3-70B-Instruct-Turbo').
|
|
38
|
+
*
|
|
39
|
+
* @param modelId - Full model ID (e.g. 'meta-llama/Llama-3.3-70B-Instruct-Turbo')
|
|
40
|
+
* @param options - Provider options
|
|
41
|
+
* @returns LanguageModel instance
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const model = togetherai('meta-llama/Llama-3.3-70B-Instruct-Turbo');
|
|
46
|
+
*
|
|
47
|
+
* // With explicit API key
|
|
48
|
+
* const model = togetherai('deepseek-ai/DeepSeek-V3', {
|
|
49
|
+
* apiKey: 'your-key',
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
declare function togetherai(modelId: string, options?: TogetherAIProviderOptions): LanguageModel;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Together AI Provider
|
|
57
|
+
*
|
|
58
|
+
* Together AI is a high-performance inference platform for open-source models
|
|
59
|
+
* (Llama, DeepSeek, Qwen, Mistral, Gemma, and more).
|
|
60
|
+
*
|
|
61
|
+
* Uses an OpenAI-compatible API — set TOGETHER_API_KEY in your environment.
|
|
62
|
+
*
|
|
63
|
+
* @see https://docs.together.ai/reference
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* // Modern pattern — returns LanguageModel directly
|
|
68
|
+
* import { togetherai } from '@yourgpt/llm-sdk/togetherai';
|
|
69
|
+
* import { generateText } from '@yourgpt/llm-sdk';
|
|
70
|
+
*
|
|
71
|
+
* const result = await generateText({
|
|
72
|
+
* model: togetherai('meta-llama/Llama-3.3-70B-Instruct-Turbo'),
|
|
73
|
+
* prompt: 'Hello!',
|
|
74
|
+
* });
|
|
75
|
+
*
|
|
76
|
+
* // Legacy pattern — returns AIProvider for createRuntime
|
|
77
|
+
* import { createTogetherAI } from '@yourgpt/llm-sdk/togetherai';
|
|
78
|
+
* import { createRuntime } from '@yourgpt/llm-sdk';
|
|
79
|
+
*
|
|
80
|
+
* const provider = createTogetherAI({ apiKey: '...' });
|
|
81
|
+
* const runtime = createRuntime({ provider, model: 'meta-llama/Llama-3.3-70B-Instruct-Turbo' });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
interface TogetherAIProviderConfig {
|
|
86
|
+
/** API key (defaults to TOGETHER_API_KEY env var) */
|
|
87
|
+
apiKey?: string;
|
|
88
|
+
/** Base URL for API */
|
|
89
|
+
baseUrl?: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Create a Together AI provider (callable, for use with createRuntime)
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* import { createTogetherAI } from '@yourgpt/llm-sdk/togetherai';
|
|
97
|
+
* import { createRuntime } from '@yourgpt/llm-sdk';
|
|
98
|
+
*
|
|
99
|
+
* const together = createTogetherAI({ apiKey: '...' });
|
|
100
|
+
* const runtime = createRuntime({
|
|
101
|
+
* provider: together,
|
|
102
|
+
* model: 'meta-llama/Llama-3.3-70B-Instruct-Turbo',
|
|
103
|
+
* });
|
|
104
|
+
*
|
|
105
|
+
* // Handle incoming chat requests
|
|
106
|
+
* return runtime.handleRequest(request);
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
declare function createTogetherAI(config?: TogetherAIProviderConfig): AIProvider;
|
|
110
|
+
declare const createTogetherAIProvider: typeof createTogetherAI;
|
|
111
|
+
|
|
112
|
+
export { type TogetherAIProviderConfig, type TogetherAIProviderOptions, createTogetherAI, createTogetherAIProvider, togetherai };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { L as LanguageModel } from '../../types-CR8mi9I0.js';
|
|
2
|
+
import { A as AIProvider } from '../../types-BctsnC3g.js';
|
|
3
|
+
import 'zod';
|
|
4
|
+
import '../../base-iGi9Va6Z.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Together AI Provider
|
|
8
|
+
*
|
|
9
|
+
* Together AI is a high-performance inference platform for open-source models
|
|
10
|
+
* (Llama, DeepSeek, Qwen, Mistral, Gemma, and more).
|
|
11
|
+
*
|
|
12
|
+
* It uses an OpenAI-compatible REST API.
|
|
13
|
+
*
|
|
14
|
+
* @see https://docs.together.ai/reference
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { togetherai } from '@yourgpt/llm-sdk/togetherai';
|
|
19
|
+
* import { generateText } from '@yourgpt/llm-sdk';
|
|
20
|
+
*
|
|
21
|
+
* const result = await generateText({
|
|
22
|
+
* model: togetherai('meta-llama/Llama-3.3-70B-Instruct-Turbo'),
|
|
23
|
+
* prompt: 'Hello!',
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
interface TogetherAIProviderOptions {
|
|
29
|
+
/** API key (defaults to TOGETHER_API_KEY env var) */
|
|
30
|
+
apiKey?: string;
|
|
31
|
+
/** Base URL for API (defaults to https://api.together.xyz/v1) */
|
|
32
|
+
baseURL?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create a Together AI language model.
|
|
36
|
+
*
|
|
37
|
+
* Model IDs follow the format `org/model-name` (e.g. 'meta-llama/Llama-3.3-70B-Instruct-Turbo').
|
|
38
|
+
*
|
|
39
|
+
* @param modelId - Full model ID (e.g. 'meta-llama/Llama-3.3-70B-Instruct-Turbo')
|
|
40
|
+
* @param options - Provider options
|
|
41
|
+
* @returns LanguageModel instance
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const model = togetherai('meta-llama/Llama-3.3-70B-Instruct-Turbo');
|
|
46
|
+
*
|
|
47
|
+
* // With explicit API key
|
|
48
|
+
* const model = togetherai('deepseek-ai/DeepSeek-V3', {
|
|
49
|
+
* apiKey: 'your-key',
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
declare function togetherai(modelId: string, options?: TogetherAIProviderOptions): LanguageModel;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Together AI Provider
|
|
57
|
+
*
|
|
58
|
+
* Together AI is a high-performance inference platform for open-source models
|
|
59
|
+
* (Llama, DeepSeek, Qwen, Mistral, Gemma, and more).
|
|
60
|
+
*
|
|
61
|
+
* Uses an OpenAI-compatible API — set TOGETHER_API_KEY in your environment.
|
|
62
|
+
*
|
|
63
|
+
* @see https://docs.together.ai/reference
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* // Modern pattern — returns LanguageModel directly
|
|
68
|
+
* import { togetherai } from '@yourgpt/llm-sdk/togetherai';
|
|
69
|
+
* import { generateText } from '@yourgpt/llm-sdk';
|
|
70
|
+
*
|
|
71
|
+
* const result = await generateText({
|
|
72
|
+
* model: togetherai('meta-llama/Llama-3.3-70B-Instruct-Turbo'),
|
|
73
|
+
* prompt: 'Hello!',
|
|
74
|
+
* });
|
|
75
|
+
*
|
|
76
|
+
* // Legacy pattern — returns AIProvider for createRuntime
|
|
77
|
+
* import { createTogetherAI } from '@yourgpt/llm-sdk/togetherai';
|
|
78
|
+
* import { createRuntime } from '@yourgpt/llm-sdk';
|
|
79
|
+
*
|
|
80
|
+
* const provider = createTogetherAI({ apiKey: '...' });
|
|
81
|
+
* const runtime = createRuntime({ provider, model: 'meta-llama/Llama-3.3-70B-Instruct-Turbo' });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
interface TogetherAIProviderConfig {
|
|
86
|
+
/** API key (defaults to TOGETHER_API_KEY env var) */
|
|
87
|
+
apiKey?: string;
|
|
88
|
+
/** Base URL for API */
|
|
89
|
+
baseUrl?: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Create a Together AI provider (callable, for use with createRuntime)
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* import { createTogetherAI } from '@yourgpt/llm-sdk/togetherai';
|
|
97
|
+
* import { createRuntime } from '@yourgpt/llm-sdk';
|
|
98
|
+
*
|
|
99
|
+
* const together = createTogetherAI({ apiKey: '...' });
|
|
100
|
+
* const runtime = createRuntime({
|
|
101
|
+
* provider: together,
|
|
102
|
+
* model: 'meta-llama/Llama-3.3-70B-Instruct-Turbo',
|
|
103
|
+
* });
|
|
104
|
+
*
|
|
105
|
+
* // Handle incoming chat requests
|
|
106
|
+
* return runtime.handleRequest(request);
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
declare function createTogetherAI(config?: TogetherAIProviderConfig): AIProvider;
|
|
110
|
+
declare const createTogetherAIProvider: typeof createTogetherAI;
|
|
111
|
+
|
|
112
|
+
export { type TogetherAIProviderConfig, type TogetherAIProviderOptions, createTogetherAI, createTogetherAIProvider, togetherai };
|