intentiai 0.1.1 → 0.1.2
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/commands/route.js +1 -1
- package/lib/api.js +19 -7
- package/package.json +1 -1
package/commands/route.js
CHANGED
|
@@ -15,7 +15,7 @@ function requireProject() {
|
|
|
15
15
|
return currentProject;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const DIFFICULTY_LEVELS = ['easy', 'medium', 'hard'];
|
|
18
|
+
const DIFFICULTY_LEVELS = ['easy', 'medium', 'hard']; // Maps to API: low, medium, high
|
|
19
19
|
const PROVIDERS = {
|
|
20
20
|
openai: ['gpt-4o', 'gpt-4o-mini', 'gpt-4-turbo', 'gpt-3.5-turbo'],
|
|
21
21
|
groq: ['llama-3.1-8b-instant', 'llama-3.3-70b-versatile', 'mixtral-8x7b-32768'],
|
package/lib/api.js
CHANGED
|
@@ -156,11 +156,20 @@ async function deleteIntent(projectId, intentId) {
|
|
|
156
156
|
// Routing endpoints
|
|
157
157
|
async function addRoute(projectId, intentName, difficulty, provider, model) {
|
|
158
158
|
const client = createClient();
|
|
159
|
+
|
|
160
|
+
// Map CLI difficulty (easy/medium/hard) to API difficulty (low/medium/high)
|
|
161
|
+
const difficultyMap = {
|
|
162
|
+
'easy': 'low',
|
|
163
|
+
'medium': 'medium',
|
|
164
|
+
'hard': 'high'
|
|
165
|
+
};
|
|
166
|
+
|
|
159
167
|
const response = await client.post(`/projects/${projectId}/routing-rules`, {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
168
|
+
name: `${intentName}_${difficulty}_rule`,
|
|
169
|
+
intent_condition: intentName,
|
|
170
|
+
difficulty_condition: difficultyMap[difficulty] || difficulty,
|
|
171
|
+
target_model_provider: provider,
|
|
172
|
+
target_model_name: model
|
|
164
173
|
});
|
|
165
174
|
return response.data;
|
|
166
175
|
}
|
|
@@ -179,11 +188,14 @@ async function deleteRoute(routeId) {
|
|
|
179
188
|
}
|
|
180
189
|
|
|
181
190
|
// Prompt endpoints
|
|
182
|
-
async function setPrompt(projectId, intentId,
|
|
191
|
+
async function setPrompt(projectId, intentId, systemMessage, name = null) {
|
|
183
192
|
const client = createClient();
|
|
184
193
|
const response = await client.post(`/projects/${projectId}/intents/${intentId}/prompts`, {
|
|
185
|
-
|
|
186
|
-
|
|
194
|
+
name: name || 'default',
|
|
195
|
+
system_message: systemMessage,
|
|
196
|
+
model_provider: 'gemini',
|
|
197
|
+
model_name: 'gemini-1.5-flash',
|
|
198
|
+
is_default: true
|
|
187
199
|
});
|
|
188
200
|
return response.data;
|
|
189
201
|
}
|