briyah 1.3.1 → 1.3.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.
Files changed (60) hide show
  1. package/data/common/config/markup +1 -1
  2. package/dist-sdk/server/src/ai/LLM/anthropic.service.js +9 -4
  3. package/docs/classes/Agent.html +15 -15
  4. package/docs/classes/Briyah.html +14 -14
  5. package/docs/classes/BriyahConfigService.html +5 -5
  6. package/docs/classes/Room.html +27 -27
  7. package/docs/classes/RoomMessage.html +10 -10
  8. package/docs/enums/MessageAction.html +3 -3
  9. package/docs/hierarchy.html +1 -1
  10. package/docs/index.html +2 -2
  11. package/docs/interfaces/AgentInfo.html +2 -2
  12. package/docs/interfaces/AgentMessagesResponse.html +2 -2
  13. package/docs/interfaces/AppService.html +119 -119
  14. package/docs/interfaces/Artifact.html +3 -3
  15. package/docs/interfaces/ArtifactMetadata.html +2 -2
  16. package/docs/interfaces/AttachDocumentResponse.html +2 -2
  17. package/docs/interfaces/BriyahConfigOptions.html +9 -9
  18. package/docs/interfaces/ChapterInfo.html +2 -2
  19. package/docs/interfaces/Character.html +2 -2
  20. package/docs/interfaces/CreateAgentResponse.html +2 -2
  21. package/docs/interfaces/CreateRoomResponse.html +2 -2
  22. package/docs/interfaces/CreateStoryResponse.html +2 -2
  23. package/docs/interfaces/FileList.html +2 -2
  24. package/docs/interfaces/FileMetadata.html +3 -3
  25. package/docs/interfaces/IConfigService.html +3 -3
  26. package/docs/interfaces/LoggingOptions.html +6 -6
  27. package/docs/interfaces/Message.html +2 -2
  28. package/docs/interfaces/ModelInfo.html +2 -2
  29. package/docs/interfaces/NativeToolDefinition.html +7 -7
  30. package/docs/interfaces/PreparedPromptResponse.html +2 -2
  31. package/docs/interfaces/ProcessTextResponse.html +2 -2
  32. package/docs/interfaces/PromptFile.html +2 -2
  33. package/docs/interfaces/PromptFileContent.html +2 -2
  34. package/docs/interfaces/PromptFilesResponse.html +2 -2
  35. package/docs/interfaces/PromptFolder.html +2 -2
  36. package/docs/interfaces/PromptFoldersResponse.html +2 -2
  37. package/docs/interfaces/RoomDetails.html +2 -2
  38. package/docs/interfaces/RoomInfo.html +2 -2
  39. package/docs/interfaces/RoomMessageUpdate.html +2 -2
  40. package/docs/interfaces/RoomMessagesResponse.html +2 -2
  41. package/docs/interfaces/SendMessageResult.html +2 -2
  42. package/docs/interfaces/StoryErrorEvent.html +3 -3
  43. package/docs/interfaces/StoryIdea.html +2 -2
  44. package/docs/interfaces/StoryInfo.html +3 -3
  45. package/docs/interfaces/StoryIntroduceCharacterEvent.html +3 -3
  46. package/docs/interfaces/StoryProgressChapterEvent.html +3 -3
  47. package/docs/interfaces/StoryState.html +5 -5
  48. package/docs/interfaces/StoryStateEvent.html +3 -3
  49. package/docs/interfaces/ToolDefinition.html +2 -2
  50. package/docs/interfaces/ToolHelpers.html +3 -3
  51. package/docs/interfaces/ToolParameter.html +2 -2
  52. package/docs/interfaces/ToolSummary.html +2 -2
  53. package/docs/interfaces/ToolsResponse.html +2 -2
  54. package/docs/interfaces/Transaction.html +2 -2
  55. package/docs/interfaces/TransactionHistoryResponse.html +2 -2
  56. package/docs/modules.html +1 -1
  57. package/docs/types/PromptScope.html +1 -1
  58. package/docs/types/ToolContext.html +2 -2
  59. package/docs/types/ToolRunResult.html +1 -1
  60. package/package.json +1 -1
@@ -1 +1 @@
1
- 13.60065100000003
1
+ 13.64082100000003
@@ -149,12 +149,16 @@ let AnthropicAiService = class AnthropicAiService extends base_ai_service_1.Base
149
149
  documentMessages[documentMessages.length - 1].content.length > 0) {
150
150
  documentMessages[documentMessages.length - 1].content[0]['cache_control'] = cacheConfig;
151
151
  }
152
- let instructionText = promptInstructions || agent.systemInstruction;
152
+ let schemaInstruction = '';
153
153
  if (jsonSchema) {
154
- instructionText +=
154
+ schemaInstruction =
155
155
  '\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
156
  JSON.stringify(jsonSchema, null, 2);
157
157
  }
158
+ let instructionText = promptInstructions || agent.systemInstruction;
159
+ if (jsonSchema && !cacheConfig) {
160
+ instructionText += schemaInstruction;
161
+ }
158
162
  const systemBlocks = [];
159
163
  if (instructionText)
160
164
  systemBlocks.push({ type: 'text', text: instructionText });
@@ -174,10 +178,11 @@ let AnthropicAiService = class AnthropicAiService extends base_ai_service_1.Base
174
178
  messageHistory[messageHistory.length - 1].content[0]['cache_control'] = cacheConfig;
175
179
  }
176
180
  const messages = [...documentMessages, ...messageHistory];
177
- if (prompt) {
181
+ if (prompt || (jsonSchema && cacheConfig)) {
182
+ const promptText = jsonSchema && cacheConfig ? (prompt || '') + schemaInstruction : prompt;
178
183
  messages.push({
179
184
  role: 'user',
180
- content: [{ type: 'text', text: prompt }],
185
+ content: [{ type: 'text', text: promptText }],
181
186
  });
182
187
  }
183
188
  const tools = [];