@blockrun/llm 2.10.0 → 2.11.1
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 +1 -0
- package/dist/index.cjs +14 -2
- package/dist/index.d.cts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +14 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -354,6 +354,7 @@ thinking modes. V4 Pro is the new flagship paid SKU — 1.6T MoE / 49B active,
|
|
|
354
354
|
### MiniMax
|
|
355
355
|
| Model | Input Price | Output Price |
|
|
356
356
|
|-------|-------------|--------------|
|
|
357
|
+
| `minimax/minimax-m3` | $0.30/M | $1.20/M |
|
|
357
358
|
| `minimax/minimax-m2.7` | $0.30/M | $1.20/M |
|
|
358
359
|
| `minimax/minimax-m2.5` | $0.30/M | $1.20/M |
|
|
359
360
|
|
package/dist/index.cjs
CHANGED
|
@@ -603,6 +603,8 @@ var LLMClient = class _LLMClient {
|
|
|
603
603
|
topP: options?.topP,
|
|
604
604
|
search: options?.search,
|
|
605
605
|
searchParameters: options?.searchParameters,
|
|
606
|
+
responseFormat: options?.responseFormat,
|
|
607
|
+
stop: options?.stop,
|
|
606
608
|
fallbackModels: options?.fallbackModels
|
|
607
609
|
});
|
|
608
610
|
return result.choices[0].message.content || "";
|
|
@@ -654,6 +656,8 @@ var LLMClient = class _LLMClient {
|
|
|
654
656
|
topP: options?.topP,
|
|
655
657
|
search: options?.search,
|
|
656
658
|
searchParameters: options?.searchParameters,
|
|
659
|
+
responseFormat: options?.responseFormat,
|
|
660
|
+
stop: options?.stop,
|
|
657
661
|
fallbackModels: fallbacks
|
|
658
662
|
});
|
|
659
663
|
return {
|
|
@@ -740,6 +744,8 @@ var LLMClient = class _LLMClient {
|
|
|
740
744
|
}
|
|
741
745
|
if (options?.tools !== void 0) body.tools = options.tools;
|
|
742
746
|
if (options?.toolChoice !== void 0) body.tool_choice = options.toolChoice;
|
|
747
|
+
if (options?.responseFormat !== void 0) body.response_format = options.responseFormat;
|
|
748
|
+
if (options?.stop !== void 0) body.stop = options.stop;
|
|
743
749
|
return body;
|
|
744
750
|
};
|
|
745
751
|
const chain = [model, ...options?.fallbackModels ?? []];
|
|
@@ -1004,6 +1010,8 @@ var LLMClient = class _LLMClient {
|
|
|
1004
1010
|
if (options?.topP !== void 0) body.top_p = options.topP;
|
|
1005
1011
|
if (options?.tools !== void 0) body.tools = options.tools;
|
|
1006
1012
|
if (options?.toolChoice !== void 0) body.tool_choice = options.toolChoice;
|
|
1013
|
+
if (options?.responseFormat !== void 0) body.response_format = options.responseFormat;
|
|
1014
|
+
if (options?.stop !== void 0) body.stop = options.stop;
|
|
1007
1015
|
const cacheKey2 = `/v1/chat/completions:${model}`;
|
|
1008
1016
|
const cached = this.preAuthCache.get(cacheKey2);
|
|
1009
1017
|
const now = Date.now();
|
|
@@ -5413,7 +5421,9 @@ var ChatCompletions = class {
|
|
|
5413
5421
|
temperature: params.temperature,
|
|
5414
5422
|
topP: params.top_p,
|
|
5415
5423
|
tools: params.tools,
|
|
5416
|
-
toolChoice: params.tool_choice
|
|
5424
|
+
toolChoice: params.tool_choice,
|
|
5425
|
+
responseFormat: params.response_format,
|
|
5426
|
+
stop: params.stop
|
|
5417
5427
|
}
|
|
5418
5428
|
);
|
|
5419
5429
|
return this.transformResponse(response);
|
|
@@ -5427,7 +5437,9 @@ var ChatCompletions = class {
|
|
|
5427
5437
|
temperature: params.temperature,
|
|
5428
5438
|
topP: params.top_p,
|
|
5429
5439
|
tools: params.tools,
|
|
5430
|
-
toolChoice: params.tool_choice
|
|
5440
|
+
toolChoice: params.tool_choice,
|
|
5441
|
+
responseFormat: params.response_format,
|
|
5442
|
+
stop: params.stop
|
|
5431
5443
|
}
|
|
5432
5444
|
);
|
|
5433
5445
|
return new StreamingResponse(response, params.model);
|
package/dist/index.d.cts
CHANGED
|
@@ -248,6 +248,19 @@ interface LLMClientOptions {
|
|
|
248
248
|
/** Request timeout in milliseconds (default: 60000) */
|
|
249
249
|
timeout?: number;
|
|
250
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* OpenAI-compatible response format. `{ type: "json_object" }` enables JSON
|
|
253
|
+
* mode — honored across all providers by the gateway (native for OpenAI/Azure,
|
|
254
|
+
* emulated via a raw-JSON system instruction for Anthropic/Bedrock).
|
|
255
|
+
*/
|
|
256
|
+
type ResponseFormat = {
|
|
257
|
+
type: "text";
|
|
258
|
+
} | {
|
|
259
|
+
type: "json_object";
|
|
260
|
+
} | {
|
|
261
|
+
type: "json_schema";
|
|
262
|
+
json_schema: Record<string, unknown>;
|
|
263
|
+
};
|
|
251
264
|
interface ChatOptions {
|
|
252
265
|
/** System prompt */
|
|
253
266
|
system?: string;
|
|
@@ -261,6 +274,10 @@ interface ChatOptions {
|
|
|
261
274
|
search?: boolean;
|
|
262
275
|
/** Full Live Search configuration (for search-enabled models) */
|
|
263
276
|
searchParameters?: SearchParameters;
|
|
277
|
+
/** Response format, e.g. { type: "json_object" } for JSON mode */
|
|
278
|
+
responseFormat?: ResponseFormat;
|
|
279
|
+
/** Up to 4 stop sequences (forwarded natively / mapped to stop_sequences) */
|
|
280
|
+
stop?: string | string[];
|
|
264
281
|
/**
|
|
265
282
|
* Models to try in order if the primary returns a transient error
|
|
266
283
|
* (timeout, network, 5xx). 4xx and PaymentError still propagate
|
|
@@ -284,6 +301,10 @@ interface ChatCompletionOptions {
|
|
|
284
301
|
tools?: Tool[];
|
|
285
302
|
/** Tool selection strategy */
|
|
286
303
|
toolChoice?: ToolChoice;
|
|
304
|
+
/** Response format, e.g. { type: "json_object" } for JSON mode */
|
|
305
|
+
responseFormat?: ResponseFormat;
|
|
306
|
+
/** Up to 4 stop sequences (forwarded natively / mapped to stop_sequences) */
|
|
307
|
+
stop?: string | string[];
|
|
287
308
|
/**
|
|
288
309
|
* Models to try in order if the primary returns a transient error
|
|
289
310
|
* (timeout, network, 5xx). 4xx and PaymentError still propagate
|
|
@@ -2736,6 +2757,7 @@ interface OpenAIChatCompletionParams {
|
|
|
2736
2757
|
}>;
|
|
2737
2758
|
max_tokens?: number;
|
|
2738
2759
|
temperature?: number;
|
|
2760
|
+
response_format?: ResponseFormat;
|
|
2739
2761
|
top_p?: number;
|
|
2740
2762
|
stream?: boolean;
|
|
2741
2763
|
n?: number;
|
|
@@ -2907,4 +2929,4 @@ declare function validateTemperature(temperature?: number): void;
|
|
|
2907
2929
|
*/
|
|
2908
2930
|
declare function validateTopP(topP?: number): void;
|
|
2909
2931
|
|
|
2910
|
-
export { APIError, AnthropicClient, type AudioModel, type AudioTrack, BASE_CHAIN_ID, type BarResolution, type BlockRunAnthropicOptions, BlockrunClient, type BlockrunClientOptions, BlockrunError, type CallInitiatedResponse, type CallModel, type CallOptions, type CallStatusResponse, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatResponseWithCost, type ChatUsage, type CostEntry, type CostEstimate, type CreatePaymentOptions, type FunctionCall, type FunctionDefinition, type HistoryOptions, ImageClient, type ImageClientOptions, type ImageData, type ImageEditOptions, type ImageGenerateOptions, type ImageModel, type ImageResponse, KNOWN_PROVIDERS, LLMClient, type LLMClientOptions, type ListOptions, type MarketSession, type Model, MusicClient, type MusicClientOptions, type MusicGenerateOptions, type MusicResponse, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PHONE_PRICES, PORTRAIT_ENROLLMENT_PRICE_USD, PaymentError, type PaymentLinks, type PhoneBuyOptions, type PhoneBuyResponse, PhoneClient, type PhoneClientOptions, type PhoneListResponse, type PhoneLookupResponse, type PhoneNumberRecord, type PhoneReleaseResponse, type PhoneRenewResponse, type PollOptions, PortraitClient, type PortraitClientOptions, type PortraitEnrollOptions, type PortraitEnrollResponse, type PriceBar, type PriceCategory, PriceClient, type PriceClientOptions, type PriceHistoryResponse, type PriceOptions, type PricePoint, type RoutingDecision, type RoutingProfile, type RoutingTier, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, SearchClient, type SearchClientOptions, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SearchUsage, type SmartChatOptions, type SmartChatResponse, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type Spending, type SpendingReport, type StockMarket, SurfClient, type SurfClientOptions, type SymbolListResponse, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, VideoClient, type VideoClientOptions, type VideoClip, type VideoGenerateOptions, type VideoModel, type VideoResponse, VoiceClient, type VoiceClientOptions, type VoicePreset, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XArticlesRisingResponse, type XAuthorAnalyticsResponse, XClient, type XClientOptions, type XCompareAuthorsResponse, type XFollower, type XFollowersResponse, type XFollowingsResponse, type XMentionsOptions, type XMentionsResponse, type XSearchOptions, type XSearchResponse, type XSearchSource, type XTrendingResponse, type XTweet, type XTweetLookupResponse, type XTweetRepliesOptions, type XTweetRepliesResponse, type XTweetThreadResponse, type XTweetsResponse, type XUser, type XUserInfoResponse, type XUserLookupResponse, type XUserTweetsOptions, type XVerifiedFollowersResponse, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatWalletCreatedMessage, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, validateMaxTokens, validateModel, validateTemperature, validateTopP };
|
|
2932
|
+
export { APIError, AnthropicClient, type AudioModel, type AudioTrack, BASE_CHAIN_ID, type BarResolution, type BlockRunAnthropicOptions, BlockrunClient, type BlockrunClientOptions, BlockrunError, type CallInitiatedResponse, type CallModel, type CallOptions, type CallStatusResponse, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatResponseWithCost, type ChatUsage, type CostEntry, type CostEstimate, type CreatePaymentOptions, type FunctionCall, type FunctionDefinition, type HistoryOptions, ImageClient, type ImageClientOptions, type ImageData, type ImageEditOptions, type ImageGenerateOptions, type ImageModel, type ImageResponse, KNOWN_PROVIDERS, LLMClient, type LLMClientOptions, type ListOptions, type MarketSession, type Model, MusicClient, type MusicClientOptions, type MusicGenerateOptions, type MusicResponse, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PHONE_PRICES, PORTRAIT_ENROLLMENT_PRICE_USD, PaymentError, type PaymentLinks, type PhoneBuyOptions, type PhoneBuyResponse, PhoneClient, type PhoneClientOptions, type PhoneListResponse, type PhoneLookupResponse, type PhoneNumberRecord, type PhoneReleaseResponse, type PhoneRenewResponse, type PollOptions, PortraitClient, type PortraitClientOptions, type PortraitEnrollOptions, type PortraitEnrollResponse, type PriceBar, type PriceCategory, PriceClient, type PriceClientOptions, type PriceHistoryResponse, type PriceOptions, type PricePoint, type ResponseFormat, type RoutingDecision, type RoutingProfile, type RoutingTier, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, SearchClient, type SearchClientOptions, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SearchUsage, type SmartChatOptions, type SmartChatResponse, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type Spending, type SpendingReport, type StockMarket, SurfClient, type SurfClientOptions, type SymbolListResponse, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, VideoClient, type VideoClientOptions, type VideoClip, type VideoGenerateOptions, type VideoModel, type VideoResponse, VoiceClient, type VoiceClientOptions, type VoicePreset, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XArticlesRisingResponse, type XAuthorAnalyticsResponse, XClient, type XClientOptions, type XCompareAuthorsResponse, type XFollower, type XFollowersResponse, type XFollowingsResponse, type XMentionsOptions, type XMentionsResponse, type XSearchOptions, type XSearchResponse, type XSearchSource, type XTrendingResponse, type XTweet, type XTweetLookupResponse, type XTweetRepliesOptions, type XTweetRepliesResponse, type XTweetThreadResponse, type XTweetsResponse, type XUser, type XUserInfoResponse, type XUserLookupResponse, type XUserTweetsOptions, type XVerifiedFollowersResponse, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatWalletCreatedMessage, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, validateMaxTokens, validateModel, validateTemperature, validateTopP };
|
package/dist/index.d.ts
CHANGED
|
@@ -248,6 +248,19 @@ interface LLMClientOptions {
|
|
|
248
248
|
/** Request timeout in milliseconds (default: 60000) */
|
|
249
249
|
timeout?: number;
|
|
250
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* OpenAI-compatible response format. `{ type: "json_object" }` enables JSON
|
|
253
|
+
* mode — honored across all providers by the gateway (native for OpenAI/Azure,
|
|
254
|
+
* emulated via a raw-JSON system instruction for Anthropic/Bedrock).
|
|
255
|
+
*/
|
|
256
|
+
type ResponseFormat = {
|
|
257
|
+
type: "text";
|
|
258
|
+
} | {
|
|
259
|
+
type: "json_object";
|
|
260
|
+
} | {
|
|
261
|
+
type: "json_schema";
|
|
262
|
+
json_schema: Record<string, unknown>;
|
|
263
|
+
};
|
|
251
264
|
interface ChatOptions {
|
|
252
265
|
/** System prompt */
|
|
253
266
|
system?: string;
|
|
@@ -261,6 +274,10 @@ interface ChatOptions {
|
|
|
261
274
|
search?: boolean;
|
|
262
275
|
/** Full Live Search configuration (for search-enabled models) */
|
|
263
276
|
searchParameters?: SearchParameters;
|
|
277
|
+
/** Response format, e.g. { type: "json_object" } for JSON mode */
|
|
278
|
+
responseFormat?: ResponseFormat;
|
|
279
|
+
/** Up to 4 stop sequences (forwarded natively / mapped to stop_sequences) */
|
|
280
|
+
stop?: string | string[];
|
|
264
281
|
/**
|
|
265
282
|
* Models to try in order if the primary returns a transient error
|
|
266
283
|
* (timeout, network, 5xx). 4xx and PaymentError still propagate
|
|
@@ -284,6 +301,10 @@ interface ChatCompletionOptions {
|
|
|
284
301
|
tools?: Tool[];
|
|
285
302
|
/** Tool selection strategy */
|
|
286
303
|
toolChoice?: ToolChoice;
|
|
304
|
+
/** Response format, e.g. { type: "json_object" } for JSON mode */
|
|
305
|
+
responseFormat?: ResponseFormat;
|
|
306
|
+
/** Up to 4 stop sequences (forwarded natively / mapped to stop_sequences) */
|
|
307
|
+
stop?: string | string[];
|
|
287
308
|
/**
|
|
288
309
|
* Models to try in order if the primary returns a transient error
|
|
289
310
|
* (timeout, network, 5xx). 4xx and PaymentError still propagate
|
|
@@ -2736,6 +2757,7 @@ interface OpenAIChatCompletionParams {
|
|
|
2736
2757
|
}>;
|
|
2737
2758
|
max_tokens?: number;
|
|
2738
2759
|
temperature?: number;
|
|
2760
|
+
response_format?: ResponseFormat;
|
|
2739
2761
|
top_p?: number;
|
|
2740
2762
|
stream?: boolean;
|
|
2741
2763
|
n?: number;
|
|
@@ -2907,4 +2929,4 @@ declare function validateTemperature(temperature?: number): void;
|
|
|
2907
2929
|
*/
|
|
2908
2930
|
declare function validateTopP(topP?: number): void;
|
|
2909
2931
|
|
|
2910
|
-
export { APIError, AnthropicClient, type AudioModel, type AudioTrack, BASE_CHAIN_ID, type BarResolution, type BlockRunAnthropicOptions, BlockrunClient, type BlockrunClientOptions, BlockrunError, type CallInitiatedResponse, type CallModel, type CallOptions, type CallStatusResponse, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatResponseWithCost, type ChatUsage, type CostEntry, type CostEstimate, type CreatePaymentOptions, type FunctionCall, type FunctionDefinition, type HistoryOptions, ImageClient, type ImageClientOptions, type ImageData, type ImageEditOptions, type ImageGenerateOptions, type ImageModel, type ImageResponse, KNOWN_PROVIDERS, LLMClient, type LLMClientOptions, type ListOptions, type MarketSession, type Model, MusicClient, type MusicClientOptions, type MusicGenerateOptions, type MusicResponse, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PHONE_PRICES, PORTRAIT_ENROLLMENT_PRICE_USD, PaymentError, type PaymentLinks, type PhoneBuyOptions, type PhoneBuyResponse, PhoneClient, type PhoneClientOptions, type PhoneListResponse, type PhoneLookupResponse, type PhoneNumberRecord, type PhoneReleaseResponse, type PhoneRenewResponse, type PollOptions, PortraitClient, type PortraitClientOptions, type PortraitEnrollOptions, type PortraitEnrollResponse, type PriceBar, type PriceCategory, PriceClient, type PriceClientOptions, type PriceHistoryResponse, type PriceOptions, type PricePoint, type RoutingDecision, type RoutingProfile, type RoutingTier, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, SearchClient, type SearchClientOptions, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SearchUsage, type SmartChatOptions, type SmartChatResponse, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type Spending, type SpendingReport, type StockMarket, SurfClient, type SurfClientOptions, type SymbolListResponse, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, VideoClient, type VideoClientOptions, type VideoClip, type VideoGenerateOptions, type VideoModel, type VideoResponse, VoiceClient, type VoiceClientOptions, type VoicePreset, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XArticlesRisingResponse, type XAuthorAnalyticsResponse, XClient, type XClientOptions, type XCompareAuthorsResponse, type XFollower, type XFollowersResponse, type XFollowingsResponse, type XMentionsOptions, type XMentionsResponse, type XSearchOptions, type XSearchResponse, type XSearchSource, type XTrendingResponse, type XTweet, type XTweetLookupResponse, type XTweetRepliesOptions, type XTweetRepliesResponse, type XTweetThreadResponse, type XTweetsResponse, type XUser, type XUserInfoResponse, type XUserLookupResponse, type XUserTweetsOptions, type XVerifiedFollowersResponse, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatWalletCreatedMessage, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, validateMaxTokens, validateModel, validateTemperature, validateTopP };
|
|
2932
|
+
export { APIError, AnthropicClient, type AudioModel, type AudioTrack, BASE_CHAIN_ID, type BarResolution, type BlockRunAnthropicOptions, BlockrunClient, type BlockrunClientOptions, BlockrunError, type CallInitiatedResponse, type CallModel, type CallOptions, type CallStatusResponse, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatResponseWithCost, type ChatUsage, type CostEntry, type CostEstimate, type CreatePaymentOptions, type FunctionCall, type FunctionDefinition, type HistoryOptions, ImageClient, type ImageClientOptions, type ImageData, type ImageEditOptions, type ImageGenerateOptions, type ImageModel, type ImageResponse, KNOWN_PROVIDERS, LLMClient, type LLMClientOptions, type ListOptions, type MarketSession, type Model, MusicClient, type MusicClientOptions, type MusicGenerateOptions, type MusicResponse, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PHONE_PRICES, PORTRAIT_ENROLLMENT_PRICE_USD, PaymentError, type PaymentLinks, type PhoneBuyOptions, type PhoneBuyResponse, PhoneClient, type PhoneClientOptions, type PhoneListResponse, type PhoneLookupResponse, type PhoneNumberRecord, type PhoneReleaseResponse, type PhoneRenewResponse, type PollOptions, PortraitClient, type PortraitClientOptions, type PortraitEnrollOptions, type PortraitEnrollResponse, type PriceBar, type PriceCategory, PriceClient, type PriceClientOptions, type PriceHistoryResponse, type PriceOptions, type PricePoint, type ResponseFormat, type RoutingDecision, type RoutingProfile, type RoutingTier, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, SearchClient, type SearchClientOptions, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SearchUsage, type SmartChatOptions, type SmartChatResponse, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type Spending, type SpendingReport, type StockMarket, SurfClient, type SurfClientOptions, type SymbolListResponse, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, VideoClient, type VideoClientOptions, type VideoClip, type VideoGenerateOptions, type VideoModel, type VideoResponse, VoiceClient, type VoiceClientOptions, type VoicePreset, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XArticlesRisingResponse, type XAuthorAnalyticsResponse, XClient, type XClientOptions, type XCompareAuthorsResponse, type XFollower, type XFollowersResponse, type XFollowingsResponse, type XMentionsOptions, type XMentionsResponse, type XSearchOptions, type XSearchResponse, type XSearchSource, type XTrendingResponse, type XTweet, type XTweetLookupResponse, type XTweetRepliesOptions, type XTweetRepliesResponse, type XTweetThreadResponse, type XTweetsResponse, type XUser, type XUserInfoResponse, type XUserLookupResponse, type XUserTweetsOptions, type XVerifiedFollowersResponse, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatWalletCreatedMessage, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, validateMaxTokens, validateModel, validateTemperature, validateTopP };
|
package/dist/index.js
CHANGED
|
@@ -500,6 +500,8 @@ var LLMClient = class _LLMClient {
|
|
|
500
500
|
topP: options?.topP,
|
|
501
501
|
search: options?.search,
|
|
502
502
|
searchParameters: options?.searchParameters,
|
|
503
|
+
responseFormat: options?.responseFormat,
|
|
504
|
+
stop: options?.stop,
|
|
503
505
|
fallbackModels: options?.fallbackModels
|
|
504
506
|
});
|
|
505
507
|
return result.choices[0].message.content || "";
|
|
@@ -551,6 +553,8 @@ var LLMClient = class _LLMClient {
|
|
|
551
553
|
topP: options?.topP,
|
|
552
554
|
search: options?.search,
|
|
553
555
|
searchParameters: options?.searchParameters,
|
|
556
|
+
responseFormat: options?.responseFormat,
|
|
557
|
+
stop: options?.stop,
|
|
554
558
|
fallbackModels: fallbacks
|
|
555
559
|
});
|
|
556
560
|
return {
|
|
@@ -637,6 +641,8 @@ var LLMClient = class _LLMClient {
|
|
|
637
641
|
}
|
|
638
642
|
if (options?.tools !== void 0) body.tools = options.tools;
|
|
639
643
|
if (options?.toolChoice !== void 0) body.tool_choice = options.toolChoice;
|
|
644
|
+
if (options?.responseFormat !== void 0) body.response_format = options.responseFormat;
|
|
645
|
+
if (options?.stop !== void 0) body.stop = options.stop;
|
|
640
646
|
return body;
|
|
641
647
|
};
|
|
642
648
|
const chain = [model, ...options?.fallbackModels ?? []];
|
|
@@ -901,6 +907,8 @@ var LLMClient = class _LLMClient {
|
|
|
901
907
|
if (options?.topP !== void 0) body.top_p = options.topP;
|
|
902
908
|
if (options?.tools !== void 0) body.tools = options.tools;
|
|
903
909
|
if (options?.toolChoice !== void 0) body.tool_choice = options.toolChoice;
|
|
910
|
+
if (options?.responseFormat !== void 0) body.response_format = options.responseFormat;
|
|
911
|
+
if (options?.stop !== void 0) body.stop = options.stop;
|
|
904
912
|
const cacheKey2 = `/v1/chat/completions:${model}`;
|
|
905
913
|
const cached = this.preAuthCache.get(cacheKey2);
|
|
906
914
|
const now = Date.now();
|
|
@@ -5310,7 +5318,9 @@ var ChatCompletions = class {
|
|
|
5310
5318
|
temperature: params.temperature,
|
|
5311
5319
|
topP: params.top_p,
|
|
5312
5320
|
tools: params.tools,
|
|
5313
|
-
toolChoice: params.tool_choice
|
|
5321
|
+
toolChoice: params.tool_choice,
|
|
5322
|
+
responseFormat: params.response_format,
|
|
5323
|
+
stop: params.stop
|
|
5314
5324
|
}
|
|
5315
5325
|
);
|
|
5316
5326
|
return this.transformResponse(response);
|
|
@@ -5324,7 +5334,9 @@ var ChatCompletions = class {
|
|
|
5324
5334
|
temperature: params.temperature,
|
|
5325
5335
|
topP: params.top_p,
|
|
5326
5336
|
tools: params.tools,
|
|
5327
|
-
toolChoice: params.tool_choice
|
|
5337
|
+
toolChoice: params.tool_choice,
|
|
5338
|
+
responseFormat: params.response_format,
|
|
5339
|
+
stop: params.stop
|
|
5328
5340
|
}
|
|
5329
5341
|
);
|
|
5330
5342
|
return new StreamingResponse(response, params.model);
|