briyah 1.3.1 → 1.3.3
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/data/common/config/image_models.json +0 -26
- package/data/common/config/markup +1 -1
- package/data/common/config/model_prices.json +976 -130
- package/dist-sdk/server/src/ai/LLM/anthropic.service.d.ts +0 -2
- package/dist-sdk/server/src/ai/LLM/anthropic.service.js +11 -12
- package/dist-sdk/server/src/sdk/briyah.js +1 -0
- package/docs/classes/Agent.html +15 -15
- package/docs/classes/Briyah.html +14 -14
- package/docs/classes/BriyahConfigService.html +5 -5
- package/docs/classes/Room.html +27 -27
- package/docs/classes/RoomMessage.html +10 -10
- package/docs/enums/MessageAction.html +3 -3
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +2 -2
- package/docs/interfaces/AgentInfo.html +2 -2
- package/docs/interfaces/AgentMessagesResponse.html +2 -2
- package/docs/interfaces/AppService.html +119 -119
- package/docs/interfaces/Artifact.html +3 -3
- package/docs/interfaces/ArtifactMetadata.html +2 -2
- package/docs/interfaces/AttachDocumentResponse.html +2 -2
- package/docs/interfaces/BriyahConfigOptions.html +9 -9
- package/docs/interfaces/ChapterInfo.html +2 -2
- package/docs/interfaces/Character.html +2 -2
- package/docs/interfaces/CreateAgentResponse.html +2 -2
- package/docs/interfaces/CreateRoomResponse.html +2 -2
- package/docs/interfaces/CreateStoryResponse.html +2 -2
- package/docs/interfaces/FileList.html +2 -2
- package/docs/interfaces/FileMetadata.html +3 -3
- package/docs/interfaces/IConfigService.html +3 -3
- package/docs/interfaces/LoggingOptions.html +6 -6
- package/docs/interfaces/Message.html +2 -2
- package/docs/interfaces/ModelInfo.html +2 -2
- package/docs/interfaces/NativeToolDefinition.html +7 -7
- package/docs/interfaces/PreparedPromptResponse.html +2 -2
- package/docs/interfaces/ProcessTextResponse.html +2 -2
- package/docs/interfaces/PromptFile.html +2 -2
- package/docs/interfaces/PromptFileContent.html +2 -2
- package/docs/interfaces/PromptFilesResponse.html +2 -2
- package/docs/interfaces/PromptFolder.html +2 -2
- package/docs/interfaces/PromptFoldersResponse.html +2 -2
- package/docs/interfaces/RoomDetails.html +2 -2
- package/docs/interfaces/RoomInfo.html +2 -2
- package/docs/interfaces/RoomMessageUpdate.html +2 -2
- package/docs/interfaces/RoomMessagesResponse.html +2 -2
- package/docs/interfaces/SendMessageResult.html +2 -2
- package/docs/interfaces/StoryErrorEvent.html +3 -3
- package/docs/interfaces/StoryIdea.html +2 -2
- package/docs/interfaces/StoryInfo.html +3 -3
- package/docs/interfaces/StoryIntroduceCharacterEvent.html +3 -3
- package/docs/interfaces/StoryProgressChapterEvent.html +3 -3
- package/docs/interfaces/StoryState.html +5 -5
- package/docs/interfaces/StoryStateEvent.html +3 -3
- package/docs/interfaces/ToolDefinition.html +2 -2
- package/docs/interfaces/ToolHelpers.html +3 -3
- package/docs/interfaces/ToolParameter.html +2 -2
- package/docs/interfaces/ToolSummary.html +2 -2
- package/docs/interfaces/ToolsResponse.html +2 -2
- package/docs/interfaces/Transaction.html +2 -2
- package/docs/interfaces/TransactionHistoryResponse.html +2 -2
- package/docs/modules.html +1 -1
- package/docs/types/PromptScope.html +1 -1
- package/docs/types/ToolContext.html +2 -2
- package/docs/types/ToolRunResult.html +1 -1
- package/package.json +1 -1
|
@@ -24,7 +24,5 @@ export declare class AnthropicAiService extends BaseAiService {
|
|
|
24
24
|
fetchModelsFromApi(): Promise<ModelInfo[]>;
|
|
25
25
|
addToConversationHistory(agent: Agent, message: string, fromSelf?: boolean): void;
|
|
26
26
|
textPrompt(agent: Agent, prompt: string, jsonSchema?: any, saveResponse?: boolean, promptInstructions?: string, cacheConfig?: any, maxOutputChars?: number): Promise<any>;
|
|
27
|
-
private static readonly EFFORT_CONFIG_MODEL_VERSIONS;
|
|
28
|
-
private usesEffortConfig;
|
|
29
27
|
private computeMessageCost;
|
|
30
28
|
}
|
|
@@ -8,7 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var AnthropicAiService_1;
|
|
12
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
12
|
exports.AnthropicAiService = void 0;
|
|
14
13
|
const common_1 = require("@nestjs/common");
|
|
@@ -19,7 +18,6 @@ const errors_1 = require("../../common/errors");
|
|
|
19
18
|
const logger_1 = require("../../common/logger");
|
|
20
19
|
const ai_debug_logger_1 = require("../ai-debug-logger");
|
|
21
20
|
let AnthropicAiService = class AnthropicAiService extends base_ai_service_1.BaseAiService {
|
|
22
|
-
static { AnthropicAiService_1 = this; }
|
|
23
21
|
anthropic;
|
|
24
22
|
constructor() {
|
|
25
23
|
super();
|
|
@@ -149,12 +147,16 @@ let AnthropicAiService = class AnthropicAiService extends base_ai_service_1.Base
|
|
|
149
147
|
documentMessages[documentMessages.length - 1].content.length > 0) {
|
|
150
148
|
documentMessages[documentMessages.length - 1].content[0]['cache_control'] = cacheConfig;
|
|
151
149
|
}
|
|
152
|
-
let
|
|
150
|
+
let schemaInstruction = '';
|
|
153
151
|
if (jsonSchema) {
|
|
154
|
-
|
|
152
|
+
schemaInstruction =
|
|
155
153
|
'\n\nIMPORTANT: You MUST respond with ONLY valid JSON that conforms to the provided schema. Do not include any explanatory text, markdown formatting, or other content before or after the JSON. Your entire response should be parseable as JSON.\n\nJSON Schema:\n' +
|
|
156
154
|
JSON.stringify(jsonSchema, null, 2);
|
|
157
155
|
}
|
|
156
|
+
let instructionText = promptInstructions || agent.systemInstruction;
|
|
157
|
+
if (jsonSchema && !cacheConfig) {
|
|
158
|
+
instructionText += schemaInstruction;
|
|
159
|
+
}
|
|
158
160
|
const systemBlocks = [];
|
|
159
161
|
if (instructionText)
|
|
160
162
|
systemBlocks.push({ type: 'text', text: instructionText });
|
|
@@ -174,10 +176,11 @@ let AnthropicAiService = class AnthropicAiService extends base_ai_service_1.Base
|
|
|
174
176
|
messageHistory[messageHistory.length - 1].content[0]['cache_control'] = cacheConfig;
|
|
175
177
|
}
|
|
176
178
|
const messages = [...documentMessages, ...messageHistory];
|
|
177
|
-
if (prompt) {
|
|
179
|
+
if (prompt || (jsonSchema && cacheConfig)) {
|
|
180
|
+
const promptText = jsonSchema && cacheConfig ? (prompt || '') + schemaInstruction : prompt;
|
|
178
181
|
messages.push({
|
|
179
182
|
role: 'user',
|
|
180
|
-
content: [{ type: 'text', text:
|
|
183
|
+
content: [{ type: 'text', text: promptText }],
|
|
181
184
|
});
|
|
182
185
|
}
|
|
183
186
|
const tools = [];
|
|
@@ -214,7 +217,7 @@ let AnthropicAiService = class AnthropicAiService extends base_ai_service_1.Base
|
|
|
214
217
|
max_tokens: maxOutputTokens,
|
|
215
218
|
tools: tools.length > 0 ? tools : undefined,
|
|
216
219
|
};
|
|
217
|
-
if (
|
|
220
|
+
if (modelInfo?.supports_adaptive_thinking) {
|
|
218
221
|
if (agent.reasoningEffort) {
|
|
219
222
|
createParams.thinking = ai_debug_logger_1.AiDebugLogger.isEnabled()
|
|
220
223
|
? { type: 'adaptive', display: 'summarized' }
|
|
@@ -318,10 +321,6 @@ let AnthropicAiService = class AnthropicAiService extends base_ai_service_1.Base
|
|
|
318
321
|
}
|
|
319
322
|
throw new Error(`Failed to get valid response after ${maxRetries} attempts. Last error: ${lastError?.message || 'Unknown error'}`);
|
|
320
323
|
}
|
|
321
|
-
static EFFORT_CONFIG_MODEL_VERSIONS = ['4-7', '4-8', 'fable', 'sonnet-5'];
|
|
322
|
-
usesEffortConfig(modelName) {
|
|
323
|
-
return AnthropicAiService_1.EFFORT_CONFIG_MODEL_VERSIONS.some((v) => modelName.includes(v));
|
|
324
|
-
}
|
|
325
324
|
computeMessageCost(agent, usage) {
|
|
326
325
|
const modelInfo = (0, model_prices_1.getModelPrices)()[agent.modelName];
|
|
327
326
|
if (!modelInfo) {
|
|
@@ -354,7 +353,7 @@ let AnthropicAiService = class AnthropicAiService extends base_ai_service_1.Base
|
|
|
354
353
|
}
|
|
355
354
|
};
|
|
356
355
|
exports.AnthropicAiService = AnthropicAiService;
|
|
357
|
-
exports.AnthropicAiService = AnthropicAiService =
|
|
356
|
+
exports.AnthropicAiService = AnthropicAiService = __decorate([
|
|
358
357
|
(0, common_1.Injectable)(),
|
|
359
358
|
__metadata("design:paramtypes", [])
|
|
360
359
|
], AnthropicAiService);
|