@umituz/react-native-ai-groq-provider 1.0.3 → 1.0.5
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/domain/entities/error.types.d.ts +34 -0
- package/dist/domain/entities/error.types.d.ts.map +1 -0
- package/dist/domain/entities/error.types.js +57 -0
- package/dist/domain/entities/error.types.js.map +1 -0
- package/dist/domain/entities/groq.types.d.ts +222 -0
- package/dist/domain/entities/groq.types.d.ts.map +1 -0
- package/dist/domain/entities/groq.types.js +37 -0
- package/dist/domain/entities/groq.types.js.map +1 -0
- package/dist/domain/entities/index.d.ts +7 -0
- package/dist/domain/entities/index.d.ts.map +1 -0
- package/dist/domain/entities/index.js +23 -0
- package/dist/domain/entities/index.js.map +1 -0
- package/dist/domain/entities/models.d.ts +50 -0
- package/dist/domain/entities/models.d.ts.map +1 -0
- package/dist/domain/entities/models.js +178 -0
- package/dist/domain/entities/models.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/services/ChatSession.d.ts +95 -0
- package/dist/infrastructure/services/ChatSession.d.ts.map +1 -0
- package/dist/infrastructure/services/ChatSession.js +177 -0
- package/dist/infrastructure/services/ChatSession.js.map +1 -0
- package/dist/infrastructure/services/GroqClient.d.ts +52 -0
- package/dist/infrastructure/services/GroqClient.d.ts.map +1 -0
- package/dist/infrastructure/services/GroqClient.js +258 -0
- package/dist/infrastructure/services/GroqClient.js.map +1 -0
- package/dist/infrastructure/services/Streaming.d.ts +27 -0
- package/dist/infrastructure/services/Streaming.d.ts.map +1 -0
- package/dist/infrastructure/services/Streaming.js +84 -0
- package/dist/infrastructure/services/Streaming.js.map +1 -0
- package/dist/infrastructure/services/StructuredText.d.ts +20 -0
- package/dist/infrastructure/services/StructuredText.d.ts.map +1 -0
- package/dist/infrastructure/services/StructuredText.js +204 -0
- package/dist/infrastructure/services/StructuredText.js.map +1 -0
- package/dist/infrastructure/services/TextGeneration.d.ts +18 -0
- package/dist/infrastructure/services/TextGeneration.d.ts.map +1 -0
- package/dist/infrastructure/services/TextGeneration.js +127 -0
- package/dist/infrastructure/services/TextGeneration.js.map +1 -0
- package/dist/infrastructure/services/index.d.ts +9 -0
- package/dist/infrastructure/services/index.d.ts.map +1 -0
- package/dist/infrastructure/services/index.js +24 -0
- package/dist/infrastructure/services/index.js.map +1 -0
- package/dist/infrastructure/telemetry/TelemetryHooks.d.ts +48 -0
- package/dist/infrastructure/telemetry/TelemetryHooks.d.ts.map +1 -0
- package/dist/infrastructure/telemetry/TelemetryHooks.js +70 -0
- package/dist/infrastructure/telemetry/TelemetryHooks.js.map +1 -0
- package/dist/infrastructure/telemetry/index.d.ts +5 -0
- package/dist/infrastructure/telemetry/index.d.ts.map +1 -0
- package/dist/infrastructure/telemetry/index.js +10 -0
- package/dist/infrastructure/telemetry/index.js.map +1 -0
- package/dist/infrastructure/utils/async/execute-state.util.d.ts +27 -0
- package/dist/infrastructure/utils/async/execute-state.util.d.ts.map +1 -0
- package/dist/infrastructure/utils/async/execute-state.util.js +50 -0
- package/dist/infrastructure/utils/async/execute-state.util.js.map +1 -0
- package/dist/infrastructure/utils/async/index.d.ts +6 -0
- package/dist/infrastructure/utils/async/index.d.ts.map +1 -0
- package/dist/infrastructure/utils/async/index.js +10 -0
- package/dist/infrastructure/utils/async/index.js.map +1 -0
- package/dist/infrastructure/utils/content-mapper.util.d.ts +34 -0
- package/dist/infrastructure/utils/content-mapper.util.d.ts.map +1 -0
- package/dist/infrastructure/utils/content-mapper.util.js +84 -0
- package/dist/infrastructure/utils/content-mapper.util.js.map +1 -0
- package/dist/infrastructure/utils/error-mapper.util.d.ts +21 -0
- package/dist/infrastructure/utils/error-mapper.util.d.ts.map +1 -0
- package/dist/infrastructure/utils/error-mapper.util.js +73 -0
- package/dist/infrastructure/utils/error-mapper.util.js.map +1 -0
- package/dist/infrastructure/utils/index.d.ts +7 -0
- package/dist/infrastructure/utils/index.d.ts.map +1 -0
- package/dist/infrastructure/utils/index.js +23 -0
- package/dist/infrastructure/utils/index.js.map +1 -0
- package/dist/presentation/hooks/useGroq.d.ts +42 -0
- package/dist/presentation/hooks/useGroq.d.ts.map +1 -0
- package/dist/presentation/hooks/useGroq.js +153 -0
- package/dist/presentation/hooks/useGroq.js.map +1 -0
- package/dist/presentation/hooks/useOperationManager.d.ts +34 -0
- package/dist/presentation/hooks/useOperationManager.d.ts.map +1 -0
- package/dist/presentation/hooks/useOperationManager.js +76 -0
- package/dist/presentation/hooks/useOperationManager.js.map +1 -0
- package/dist/providers/ConfigBuilder.d.ts +86 -0
- package/dist/providers/ConfigBuilder.d.ts.map +1 -0
- package/dist/providers/ConfigBuilder.js +147 -0
- package/dist/providers/ConfigBuilder.js.map +1 -0
- package/dist/providers/ProviderFactory.d.ts +56 -0
- package/dist/providers/ProviderFactory.d.ts.map +1 -0
- package/dist/providers/ProviderFactory.js +75 -0
- package/dist/providers/ProviderFactory.js.map +1 -0
- package/dist/providers/index.d.ts +7 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +15 -0
- package/dist/providers/index.js.map +1 -0
- package/package.json +1 -1
- package/src/infrastructure/services/GroqClient.ts +61 -1
- package/src/infrastructure/services/StructuredText.ts +94 -1
- package/src/infrastructure/services/TextGeneration.ts +70 -0
|
@@ -25,8 +25,18 @@ export async function textGeneration(
|
|
|
25
25
|
prompt: string,
|
|
26
26
|
options: TextGenerationOptions = {}
|
|
27
27
|
): Promise<string> {
|
|
28
|
+
const startTime = Date.now();
|
|
28
29
|
const model = options.model || DEFAULT_MODELS.TEXT;
|
|
29
30
|
|
|
31
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
32
|
+
console.log("[Groq] textGeneration called:", {
|
|
33
|
+
model,
|
|
34
|
+
promptLength: prompt.length,
|
|
35
|
+
promptPreview: prompt.substring(0, 100) + "...",
|
|
36
|
+
options: options.generationConfig,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
30
40
|
const messages: GroqMessage[] = [
|
|
31
41
|
{
|
|
32
42
|
role: "user",
|
|
@@ -46,7 +56,31 @@ export async function textGeneration(
|
|
|
46
56
|
presence_penalty: options.generationConfig?.presencePenalty,
|
|
47
57
|
};
|
|
48
58
|
|
|
59
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
60
|
+
console.log("[Groq] Sending request to API:", {
|
|
61
|
+
endpoint: "/v1/chat/completions",
|
|
62
|
+
requestBody: {
|
|
63
|
+
model: request.model,
|
|
64
|
+
messageCount: request.messages.length,
|
|
65
|
+
temperature: request.temperature,
|
|
66
|
+
max_tokens: request.max_tokens,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const apiStartTime = Date.now();
|
|
49
72
|
const response = await groqHttpClient.chatCompletion(request);
|
|
73
|
+
const apiDuration = Date.now() - apiStartTime;
|
|
74
|
+
|
|
75
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
76
|
+
console.log("[Groq] API response received:", {
|
|
77
|
+
apiDuration: `${apiDuration}ms`,
|
|
78
|
+
hasChoices: !!response.choices?.length,
|
|
79
|
+
choiceCount: response.choices?.length || 0,
|
|
80
|
+
usage: response.usage,
|
|
81
|
+
finishReason: response.choices?.[0]?.finish_reason,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
50
84
|
|
|
51
85
|
const content = response.choices[0]?.message?.content;
|
|
52
86
|
if (!content) {
|
|
@@ -56,6 +90,15 @@ export async function textGeneration(
|
|
|
56
90
|
);
|
|
57
91
|
}
|
|
58
92
|
|
|
93
|
+
const totalDuration = Date.now() - startTime;
|
|
94
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
95
|
+
console.log("[Groq] textGeneration complete:", {
|
|
96
|
+
totalDuration: `${totalDuration}ms`,
|
|
97
|
+
responseLength: content.length,
|
|
98
|
+
responsePreview: content.substring(0, 200) + "...",
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
59
102
|
return content;
|
|
60
103
|
}
|
|
61
104
|
|
|
@@ -66,8 +109,17 @@ export async function chatGeneration(
|
|
|
66
109
|
messages: GroqMessage[],
|
|
67
110
|
options: TextGenerationOptions = {}
|
|
68
111
|
): Promise<string> {
|
|
112
|
+
const startTime = Date.now();
|
|
69
113
|
const model = options.model || DEFAULT_MODELS.TEXT;
|
|
70
114
|
|
|
115
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
116
|
+
console.log("[Groq] chatGeneration called:", {
|
|
117
|
+
model,
|
|
118
|
+
messageCount: messages.length,
|
|
119
|
+
options: options.generationConfig,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
71
123
|
const request: GroqChatRequest = {
|
|
72
124
|
model,
|
|
73
125
|
messages,
|
|
@@ -80,7 +132,17 @@ export async function chatGeneration(
|
|
|
80
132
|
presence_penalty: options.generationConfig?.presencePenalty,
|
|
81
133
|
};
|
|
82
134
|
|
|
135
|
+
const apiStartTime = Date.now();
|
|
83
136
|
const response = await groqHttpClient.chatCompletion(request);
|
|
137
|
+
const apiDuration = Date.now() - apiStartTime;
|
|
138
|
+
|
|
139
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
140
|
+
console.log("[Groq] chatGeneration API response:", {
|
|
141
|
+
apiDuration: `${apiDuration}ms`,
|
|
142
|
+
usage: response.usage,
|
|
143
|
+
finishReason: response.choices?.[0]?.finish_reason,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
84
146
|
|
|
85
147
|
const content = response.choices[0]?.message?.content;
|
|
86
148
|
if (!content) {
|
|
@@ -90,5 +152,13 @@ export async function chatGeneration(
|
|
|
90
152
|
);
|
|
91
153
|
}
|
|
92
154
|
|
|
155
|
+
const totalDuration = Date.now() - startTime;
|
|
156
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
157
|
+
console.log("[Groq] chatGeneration complete:", {
|
|
158
|
+
totalDuration: `${totalDuration}ms`,
|
|
159
|
+
responseLength: content.length,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
93
163
|
return content;
|
|
94
164
|
}
|