@llmnative/react 1.45.0 → 1.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1123 -1106
- package/dist/index.mjs.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/providers/ai/AIProvider.d.ts +8 -0
- package/dist/types/src/providers/ai/anthropic.d.ts +1 -1
- package/dist/types/src/providers/ai/index.d.ts +1 -1
- package/dist/types/src/providers/ai/openaiCompatible.d.ts +3 -1
- package/dist/types/src/providers/ai/shared.d.ts +9 -1
- package/llms-full.txt +7 -0
- package/package.json +1 -1
|
@@ -80,7 +80,7 @@ export { loadGoogleMaps } from './providers/googleMaps/loadGoogleMaps';
|
|
|
80
80
|
export type { GoogleMapsConfig } from './providers/googleMaps/loadGoogleMaps';
|
|
81
81
|
export { useEmailProvider, EmailProvider } from './providers/email/EmailProviderContext';
|
|
82
82
|
export { GmailEmailProvider } from './providers/email/google/GmailEmailProvider';
|
|
83
|
-
export type { AIRequestOptions, AIAttachment, AIProviderAdapter, AIKeyValidationResult, AIModelDescriptor, AIModelPricing, DiscoveredAIModel, AIProviderCapabilities, AIModelCatalog, AIProviderDefinition, AICompleteRequest, AICompleteResult, AIConversationTurn, AIToolDefinition, AIToolCall, AIToolResult, CloudflareProviderOptions, ServerAIProviderConnection, ServerAIConnection, ModelIdentity, ModelIdentityEntry, ModelIdentityIndex, ResolvedModel, ModelOffer, ModelCost, } from './providers/ai';
|
|
83
|
+
export type { AIRequestOptions, AIReasoningLevel, AIAttachment, AIProviderAdapter, AIKeyValidationResult, AIModelDescriptor, AIModelPricing, DiscoveredAIModel, AIProviderCapabilities, AIModelCatalog, AIProviderDefinition, AICompleteRequest, AICompleteResult, AIConversationTurn, AIToolDefinition, AIToolCall, AIToolResult, CloudflareProviderOptions, ServerAIProviderConnection, ServerAIConnection, ModelIdentity, ModelIdentityEntry, ModelIdentityIndex, ResolvedModel, ModelOffer, ModelCost, } from './providers/ai';
|
|
84
84
|
export { createAIProviderRegistry, getAIModelCatalog, formatAIModelRef, parseAIModelRef, isFreeAIModel, AI_PROVIDER_DEFINITIONS, AI_PROVIDER_DESCRIPTORS, OPENAI_COMPATIBLE_PROVIDER_DESCRIPTOR, CLOUDFLARE_PROVIDER_DESCRIPTOR, createCloudflareProviderDefinition, toProviderDescriptor, createServerCredentialAIRegistry, serverCredential, SERVER_CREDENTIAL_PREFIX, AI_PROVIDER_HOSTS, isAIProviderTarget, canonicalModelName, buildModelIdentityIndex, resolveModel, modelOffers, loadModelIdentityIndex } from './providers/ai';
|
|
85
85
|
export type { ProviderDescriptor, ProviderCredentialField } from './providers/ProviderDescriptor';
|
|
86
86
|
export { useAIProvider, useAIProviderRegistry, AIProvider } from './providers/ai/AIProviderContext';
|
|
@@ -32,6 +32,8 @@ export interface AIAttachment {
|
|
|
32
32
|
base64: string;
|
|
33
33
|
name?: string;
|
|
34
34
|
}
|
|
35
|
+
/** How much a model reasons before it answers (CR-122). */
|
|
36
|
+
export type AIReasoningLevel = 'low' | 'medium' | 'high' | 'max';
|
|
35
37
|
export interface AIRequestOptions {
|
|
36
38
|
language?: string;
|
|
37
39
|
voice?: string;
|
|
@@ -40,6 +42,12 @@ export interface AIRequestOptions {
|
|
|
40
42
|
model?: string;
|
|
41
43
|
temperature?: number;
|
|
42
44
|
attachments?: AIAttachment[];
|
|
45
|
+
/**
|
|
46
|
+
* How much the model reasons (CR-122), on the models that take it: Anthropic `output_config.effort`
|
|
47
|
+
* (Claude 4.6 and later), OpenAI `reasoning_effort` (o-series, GPT-5; `max` as `high`), OpenRouter
|
|
48
|
+
* `reasoning.effort`. Elsewhere (older models, Gemini) nothing is sent. Absent: the default of the model.
|
|
49
|
+
*/
|
|
50
|
+
reasoning?: AIReasoningLevel;
|
|
43
51
|
}
|
|
44
52
|
/** Definizione di un tool che il modello può scegliere di invocare — la SDK del provider
|
|
45
53
|
* riceve solo questa forma (JSON-serializzabile); l'implementazione vera resta lato
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AIProviderDefinition } from './shared';
|
|
2
2
|
export declare const ANTHROPIC_PROVIDER_DEFINITION: AIProviderDefinition;
|
|
@@ -2,7 +2,7 @@ import type { AIConfig } from '../../Config';
|
|
|
2
2
|
import type { ProviderDescriptor } from '../ProviderDescriptor';
|
|
3
3
|
import type { AIProviderAdapter } from './AIProvider';
|
|
4
4
|
import { type AIProviderDefinition, type BuiltInAIProviderId } from './shared';
|
|
5
|
-
export type { AIProviderAdapter, AIKeyValidationResult, AIModelDescriptor, AIModelPricing, AIProviderCapabilities, AIRequestOptions, AIAttachment, AICompleteRequest, AICompleteResult, AIConversationTurn, AIToolDefinition, AIToolCall, AIToolResult, } from './AIProvider';
|
|
5
|
+
export type { AIProviderAdapter, AIKeyValidationResult, AIModelDescriptor, AIModelPricing, AIProviderCapabilities, AIRequestOptions, AIReasoningLevel, AIAttachment, AICompleteRequest, AICompleteResult, AIConversationTurn, AIToolDefinition, AIToolCall, AIToolResult, } from './AIProvider';
|
|
6
6
|
export { formatAIModelRef, parseAIModelRef, isFreeAIModel } from './AIProvider';
|
|
7
7
|
export type { DiscoveredAIModel } from './shared';
|
|
8
8
|
export type { AIModelCatalog, AIProviderDefinition } from './shared';
|
|
@@ -17,6 +17,8 @@ type OpenAICompatibleDefinitionOptions = {
|
|
|
17
17
|
validateApiKey?: AIProviderDefinition['validateApiKey'];
|
|
18
18
|
/** Maps one `/models` entry — for providers whose listing also reports prices (OpenRouter). */
|
|
19
19
|
mapModelEntry?: (entry: Record<string, unknown>) => string | DiscoveredAIModel | undefined;
|
|
20
|
+
/** How a reasoning level is sent (CR-122): `reasoning_effort` on the reasoning models of OpenAI, or OpenRouter's `reasoning.effort`. */
|
|
21
|
+
reasoningStyle?: 'openai' | 'openrouter';
|
|
20
22
|
};
|
|
21
23
|
/** Esportate per riuso da provider "chat completions"-simili ma non costruiti tramite
|
|
22
24
|
* createOpenAICompatibleProviderDefinition (vedi opencode.ts) — stesso wire format OpenAI,
|
|
@@ -39,5 +41,5 @@ export declare function parseOpenAIResponse(response: {
|
|
|
39
41
|
message?: Record<string, unknown>;
|
|
40
42
|
}>;
|
|
41
43
|
} | null): AICompleteResult | null;
|
|
42
|
-
export declare const createOpenAICompatibleProviderDefinition: ({ id, label, description, configKey, requiredConfigKeys, defaultModel, fallbackModels, baseUrl, modelsUrl, chatCompletionsUrl, dashboardUrl, credentialsHint, validateApiKey: validateApiKeyOverride, mapModelEntry, }: OpenAICompatibleDefinitionOptions) => AIProviderDefinition;
|
|
44
|
+
export declare const createOpenAICompatibleProviderDefinition: ({ id, label, description, configKey, requiredConfigKeys, defaultModel, fallbackModels, baseUrl, modelsUrl, chatCompletionsUrl, dashboardUrl, credentialsHint, validateApiKey: validateApiKeyOverride, mapModelEntry, reasoningStyle, }: OpenAICompatibleDefinitionOptions) => AIProviderDefinition;
|
|
43
45
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ProviderConfigurationState } from '../ProviderConfiguration';
|
|
2
2
|
import type { ProviderCredentialField } from '../ProviderDescriptor';
|
|
3
|
-
import type { AICompleteRequest, AICompleteResult, AIKeyValidationResult, AIModelDescriptor, AIModelPricing, AIProviderAdapter, AIProviderCapabilities, AIRequestOptions } from './AIProvider';
|
|
3
|
+
import type { AICompleteRequest, AICompleteResult, AIKeyValidationResult, AIModelDescriptor, AIModelPricing, AIProviderAdapter, AIProviderCapabilities, AIReasoningLevel, AIRequestOptions } from './AIProvider';
|
|
4
4
|
export type BuiltInAIProviderId = 'openai' | 'openrouter' | 'opencode' | 'opencode-go' | 'openai-compatible' | 'deepseek' | 'gemini' | 'anthropic' | 'mistral' | 'glm' | 'cloudflare' | 'groq';
|
|
5
5
|
/** A discovered model carrying the price its provider listing already reports (OpenRouter,
|
|
6
6
|
* Cloudflare). Models discovered as a bare id get their price from models.dev instead. */
|
|
@@ -41,6 +41,14 @@ export type AIModelCatalog = {
|
|
|
41
41
|
modelsByProvider: Record<string, AIModelDescriptor[]>;
|
|
42
42
|
capabilitiesByProvider: Record<string, AIProviderCapabilities>;
|
|
43
43
|
};
|
|
44
|
+
/** What an Anthropic Messages request carries for a reasoning level (CR-122); nothing for a model that does not take it. */
|
|
45
|
+
export declare function anthropicReasoning(model: string | undefined, level: AIReasoningLevel | undefined): Record<string, unknown>;
|
|
46
|
+
/**
|
|
47
|
+
* What an OpenAI Chat Completions request carries for a reasoning level (CR-122): `reasoning_effort` on the
|
|
48
|
+
* reasoning models of OpenAI (`max` as `high`, their top); OpenRouter `reasoning.effort` on any model, which
|
|
49
|
+
* it maps itself. Nothing otherwise.
|
|
50
|
+
*/
|
|
51
|
+
export declare function openAIReasoning(model: string | undefined, level: AIReasoningLevel | undefined, style?: 'openai' | 'openrouter'): Record<string, unknown>;
|
|
44
52
|
export declare const extractProviderError: (err: unknown) => string;
|
|
45
53
|
export declare const createBrowserTransportError: (label: string) => Error;
|
|
46
54
|
export declare const parseTextResponse: (value: unknown) => string | null;
|
package/llms-full.txt
CHANGED
|
@@ -1165,6 +1165,13 @@ class MyAIProvider implements AIProviderAdapter {
|
|
|
1165
1165
|
async array(prompt: string, options?: AIRequestOptions): Promise<string[]> { ... }
|
|
1166
1166
|
}
|
|
1167
1167
|
|
|
1168
|
+
// Quanto ragiona il modello (CR-122): `reasoning: 'low' | 'medium' | 'high' | 'max'` (AIReasoningLevel) su
|
|
1169
|
+
// una richiesta. Anthropic: `output_config.effort` sui Claude 4.6 e successivi (+ thinking adaptive su Opus
|
|
1170
|
+
// 4.6-4.8 e Sonnet 4.6); OpenAI e compatibili (OpenCode, DeepSeek, Groq…): `reasoning_effort` solo sui modelli
|
|
1171
|
+
// di ragionamento di OpenAI (serie o, GPT-5; max = high); OpenRouter: `reasoning.effort` su ogni modello.
|
|
1172
|
+
// Altrove (modelli più vecchi, Gemini) non si manda nulla: il default del modello.
|
|
1173
|
+
await ai.complete({ prompt: 'Rivedi questo piano', model: 'claude-opus-5-5', reasoning: 'high' })
|
|
1174
|
+
|
|
1168
1175
|
// Factory per registri esterni
|
|
1169
1176
|
const registry = createAIProviderRegistry(definitions)
|
|
1170
1177
|
// Azioni di Chatbot (CR-107): con `content` aprono un menu; senza, sono pulsanti con `onClick`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llmnative/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.46.0",
|
|
4
4
|
"description": "LLM-native React framework for deterministic UI generation. Data-driven by default, schema-driven optional. Ultra-low token consumption — built for AI agents, not just humans.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|