@breadstone/archipel-mcp 0.0.43 → 0.0.45
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/guides/ai-text-generation.md +402 -111
- package/data/packages/platform-intelligence/api/Class.IntelligenceHealthIndicator.md +5 -5
- package/data/packages/platform-intelligence/api/Class.IntelligenceModule.md +26 -2
- package/data/packages/platform-intelligence/api/Class.IntelligenceTextGenerator.md +43 -9
- package/data/packages/platform-intelligence/api/Class.IntelligenceToolBase.md +93 -0
- package/data/packages/platform-intelligence/api/Class.IntelligenceToolRegistry.md +217 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicAdvisor20260301Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicBash20241022Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicBash20250124Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicCodeExecution20250522Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicCodeExecution20250825Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicCodeExecution20260120Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicComputer20241022Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicComputer20250124Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicComputer20251124Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicMemory20250818Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicTextEditor20241022Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicTextEditor20250124Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicTextEditor20250429Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicTextEditor20250728Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicToolSearchBM2520251119Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicToolSearchRegex20251119Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicWebFetch20250910Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicWebFetch20260209Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicWebSearch20250305Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createAnthropicWebSearch20260209Tool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createGoogleCodeExecutionTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createGoogleEnterpriseWebSearchTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createGoogleFileSearchTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createGoogleGoogleMapsTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createGoogleGoogleSearchTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createGoogleUrlContextTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createGoogleVertexRagStoreTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createGrokCodeExecutionTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createGrokFileSearchTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createGrokMcpServerTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createGrokViewImageTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createGrokViewXVideoTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createGrokWebSearchTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createGrokXSearchTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createIntelligenceTool.md +27 -0
- package/data/packages/platform-intelligence/api/Function.createOpenAIApplyPatchTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createOpenAICodeInterpreterTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createOpenAICustomTool.md +27 -0
- package/data/packages/platform-intelligence/api/Function.createOpenAIFileSearchTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createOpenAIImageGenerationTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createOpenAILocalShellTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createOpenAIMcpTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createOpenAIShellTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createOpenAIToolSearchTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createOpenAIWebSearchPreviewTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createOpenAIWebSearchTool.md +26 -0
- package/data/packages/platform-intelligence/api/Function.createProviderOptions.md +15 -2
- package/data/packages/platform-intelligence/api/Function.loadAnthropicLanguageModel.md +4 -4
- package/data/packages/platform-intelligence/api/Function.loadGoogleLanguageModel.md +4 -4
- package/data/packages/platform-intelligence/api/Function.loadGrokLanguageModel.md +4 -4
- package/data/packages/platform-intelligence/api/Function.loadOpenAILanguageModel.md +4 -4
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceModuleOptions.md +79 -0
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceTextCompletion.md +30 -6
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceTextGenerationOptions.md +106 -5
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceTextGenerator.md +29 -4
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceTextStreamingOptions.md +183 -0
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceTool.md +39 -0
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceToolRegistry.md +146 -0
- package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceLanguageModelLoader.md +3 -3
- package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceLanguageModelLoaders.md +14 -0
- package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceTextStream.md +14 -0
- package/data/packages/platform-intelligence/api/Variable.ANTHROPIC_API_KEY.md +1 -1
- package/data/packages/platform-intelligence/api/Variable.ANTHROPIC_BASE_URL.md +1 -1
- package/data/packages/platform-intelligence/api/Variable.ANTHROPIC_CONFIG_ENTRIES.md +14 -0
- package/data/packages/platform-intelligence/api/Variable.AnthropicIntelligenceToolNames.md +42 -0
- package/data/packages/platform-intelligence/api/Variable.GEMINI_API_KEY.md +2 -2
- package/data/packages/platform-intelligence/api/Variable.GOOGLE_API_KEY.md +1 -1
- package/data/packages/platform-intelligence/api/Variable.GOOGLE_BASE_URL.md +1 -1
- package/data/packages/platform-intelligence/api/Variable.GOOGLE_CONFIG_ENTRIES.md +14 -0
- package/data/packages/platform-intelligence/api/Variable.GROK_API_KEY.md +1 -1
- package/data/packages/platform-intelligence/api/Variable.GROK_BASE_URL.md +1 -1
- package/data/packages/platform-intelligence/api/Variable.GROK_CONFIG_ENTRIES.md +14 -0
- package/data/packages/platform-intelligence/api/Variable.GoogleIntelligenceToolNames.md +34 -0
- package/data/packages/platform-intelligence/api/Variable.GrokIntelligenceToolNames.md +34 -0
- package/data/packages/platform-intelligence/api/Variable.INTELLIGENCE_API_KEY.md +1 -1
- package/data/packages/platform-intelligence/api/Variable.INTELLIGENCE_BASE_URL.md +1 -1
- package/data/packages/platform-intelligence/api/Variable.INTELLIGENCE_MAX_OUTPUT_TOKENS.md +1 -1
- package/data/packages/platform-intelligence/api/Variable.INTELLIGENCE_MODEL.md +1 -1
- package/data/packages/platform-intelligence/api/Variable.INTELLIGENCE_PROVIDER.md +1 -1
- package/data/packages/platform-intelligence/api/Variable.INTELLIGENCE_TEMPERATURE.md +1 -1
- package/data/packages/platform-intelligence/api/Variable.INTELLIGENCE_TOP_P.md +1 -1
- package/data/packages/platform-intelligence/api/Variable.OPENAI_API_KEY.md +1 -1
- package/data/packages/platform-intelligence/api/Variable.OPENAI_BASE_URL.md +1 -1
- package/data/packages/platform-intelligence/api/Variable.OPENAI_CONFIG_ENTRIES.md +14 -0
- package/data/packages/platform-intelligence/api/Variable.OpenAIIntelligenceToolNames.md +40 -0
- package/data/packages/platform-intelligence/api/Variable.PLATFORM_INTELLIGENCE_CONFIG_ENTRIES.md +1 -1
- package/data/packages/platform-intelligence/api/Variable.XAI_API_KEY.md +2 -2
- package/data/packages/platform-intelligence/api/Variable.XAI_BASE_URL.md +2 -2
- package/data/packages/platform-intelligence/api/index.md +72 -33
- package/data/packages/platform-intelligence/index.md +280 -69
- package/package.json +1 -1
- package/data/packages/platform-intelligence/api/Class.IntelligenceCapabilityRegistrarBase.md +0 -94
- package/data/packages/platform-intelligence/api/Class.IntelligenceCapabilityRegistry.md +0 -106
- package/data/packages/platform-intelligence/api/Function.loadProviderFactory.md +0 -31
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceArtifact.md +0 -34
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceCapability.md +0 -71
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceCapabilityMetadata.md +0 -70
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceCapabilityPayload.md +0 -46
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceCapabilityRegistry.md +0 -78
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceCapabilityResult.md +0 -46
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceContext.md +0 -72
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceContextBuilder.md +0 -35
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceConversationMessageSnapshot.md +0 -70
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceConversationSnapshot.md +0 -58
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceFollowUpQuestion.md +0 -46
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceIntent.md +0 -46
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceIntentEntity.md +0 -34
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceMessageModel.md +0 -70
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceMessagePayload.md +0 -34
- package/data/packages/platform-intelligence/api/Interface.IIntelligencePrompt.md +0 -34
- package/data/packages/platform-intelligence/api/Interface.IIntelligencePromptMessage.md +0 -34
- package/data/packages/platform-intelligence/api/Interface.IIntelligenceResponseMessage.md +0 -34
- package/data/packages/platform-intelligence/api/TypeAlias.IntelligenceConversationMessageRole.md +0 -14
- package/data/packages/platform-intelligence/api/Variable.IntelligenceConversationMessageRoles.md +0 -26
|
@@ -9,50 +9,37 @@ editUrl: false
|
|
|
9
9
|
|
|
10
10
|
| Class | Description |
|
|
11
11
|
| ------ | ------ |
|
|
12
|
-
| [IntelligenceCapabilityRegistrarBase](Class.IntelligenceCapabilityRegistrarBase) | Provides a reusable registration flow that allows feature modules to contribute capabilities to the global intelligence registry while keeping their implementation details private. |
|
|
13
|
-
| [IntelligenceCapabilityRegistry](Class.IntelligenceCapabilityRegistry) | Central registry responsible for resolving intelligence capabilities based on intent metadata. |
|
|
14
12
|
| [IntelligenceConfigurationError](Class.IntelligenceConfigurationError) | Error thrown when an intelligence provider configuration is invalid or missing. |
|
|
15
|
-
| [IntelligenceHealthIndicator](Class.IntelligenceHealthIndicator) | Health indicator for the intelligence infrastructure. Verifies that
|
|
16
|
-
| [IntelligenceModule](Class.IntelligenceModule) | Core module exposing the shared intelligence infrastructure
|
|
13
|
+
| [IntelligenceHealthIndicator](Class.IntelligenceHealthIndicator) | Health indicator for the intelligence infrastructure. Verifies that the intelligence provider configuration can be resolved. |
|
|
14
|
+
| [IntelligenceModule](Class.IntelligenceModule) | Core module exposing the shared intelligence infrastructure. |
|
|
17
15
|
| [IntelligenceProviderError](Class.IntelligenceProviderError) | Error thrown when an intelligence provider call fails. |
|
|
18
16
|
| [IntelligenceTextGenerator](Class.IntelligenceTextGenerator) | Executes text completions using the configured intelligence provider. |
|
|
17
|
+
| [IntelligenceToolBase](Class.IntelligenceToolBase) | Base class for class-based AI SDK tools. |
|
|
18
|
+
| [IntelligenceToolRegistry](Class.IntelligenceToolRegistry) | Registry for class-based intelligence tools. |
|
|
19
19
|
| [IntelligenceValidationError](Class.IntelligenceValidationError) | Error thrown when an intelligence input validation fails. |
|
|
20
20
|
|
|
21
21
|
## Interfaces
|
|
22
22
|
|
|
23
23
|
| Interface | Description |
|
|
24
24
|
| ------ | ------ |
|
|
25
|
-
| [IIntelligenceArtifact](Interface.IIntelligenceArtifact) | Represents a structured artifact returned by a capability. |
|
|
26
|
-
| [IIntelligenceCapability](Interface.IIntelligenceCapability) | Abstraction implemented by all capability providers. |
|
|
27
|
-
| [IIntelligenceCapabilityMetadata](Interface.IIntelligenceCapabilityMetadata) | Metadata describing a capability for orchestration and analytics purposes. |
|
|
28
|
-
| [IIntelligenceCapabilityPayload](Interface.IIntelligenceCapabilityPayload) | Payload forwarded to capabilities for execution. |
|
|
29
|
-
| [IIntelligenceCapabilityRegistry](Interface.IIntelligenceCapabilityRegistry) | Registry abstraction responsible for resolving capabilities. |
|
|
30
|
-
| [IIntelligenceCapabilityResult](Interface.IIntelligenceCapabilityResult) | Represents the outcome produced by a capability execution. |
|
|
31
25
|
| [IIntelligenceCompletionUsage](Interface.IIntelligenceCompletionUsage) | Captures usage telemetry returned by the intelligence provider. |
|
|
32
|
-
| [
|
|
33
|
-
| [IIntelligenceContextBuilder](Interface.IIntelligenceContextBuilder) | Responsible for composing the context supplied to capabilities. |
|
|
34
|
-
| [IIntelligenceConversationMessageSnapshot](Interface.IIntelligenceConversationMessageSnapshot) | Represents a single message returned within a conversation snapshot. |
|
|
35
|
-
| [IIntelligenceConversationSnapshot](Interface.IIntelligenceConversationSnapshot) | Represents a lightweight snapshot of a conversation used for context building. |
|
|
36
|
-
| [IIntelligenceFollowUpQuestion](Interface.IIntelligenceFollowUpQuestion) | Represents a follow-up question suggested to keep the dialogue active. |
|
|
37
|
-
| [IIntelligenceIntent](Interface.IIntelligenceIntent) | Represents the structured intent resolved from a user message. |
|
|
38
|
-
| [IIntelligenceIntentEntity](Interface.IIntelligenceIntentEntity) | Represents an entity extracted from a resolved intelligence intent. |
|
|
39
|
-
| [IIntelligenceMessageModel](Interface.IIntelligenceMessageModel) | Represents a normalized message stored in persistence. |
|
|
40
|
-
| [IIntelligenceMessagePayload](Interface.IIntelligenceMessagePayload) | Carries the payload submitted when messaging the intelligence entrypoint. |
|
|
41
|
-
| [IIntelligencePrompt](Interface.IIntelligencePrompt) | Represents the input supplied to the intelligence text generator. |
|
|
42
|
-
| [IIntelligencePromptMessage](Interface.IIntelligencePromptMessage) | Describes a normalized message used for text generation prompts. |
|
|
26
|
+
| [IIntelligenceModuleOptions](Interface.IIntelligenceModuleOptions) | Options for configuring the intelligence module. |
|
|
43
27
|
| [IIntelligenceProviderConfiguration](Interface.IIntelligenceProviderConfiguration) | Describes the resolved configuration for the intelligence provider. |
|
|
44
|
-
| [IIntelligenceResponseMessage](Interface.IIntelligenceResponseMessage) | Represents a single assistant message returned by a capability. |
|
|
45
28
|
| [IIntelligenceTextCompletion](Interface.IIntelligenceTextCompletion) | Represents the normalized completion result produced by the intelligence provider. |
|
|
46
29
|
| [IIntelligenceTextGenerationOptions](Interface.IIntelligenceTextGenerationOptions) | Options that can be supplied when generating text with the intelligence provider. |
|
|
47
30
|
| [IIntelligenceTextGenerator](Interface.IIntelligenceTextGenerator) | Abstraction responsible for executing text completions using the configured provider. |
|
|
31
|
+
| [IIntelligenceTextStreamingOptions](Interface.IIntelligenceTextStreamingOptions) | Options that can be supplied when streaming text with the intelligence provider. |
|
|
32
|
+
| [IIntelligenceTool](Interface.IIntelligenceTool) | Minimal shape required by the intelligence tool registry. |
|
|
33
|
+
| [IIntelligenceToolRegistry](Interface.IIntelligenceToolRegistry) | Contract for the intelligence tool registry. |
|
|
48
34
|
|
|
49
35
|
## Type Aliases
|
|
50
36
|
|
|
51
37
|
| Type Alias | Description |
|
|
52
38
|
| ------ | ------ |
|
|
53
|
-
| [
|
|
54
|
-
| [
|
|
39
|
+
| [IntelligenceLanguageModelLoader](TypeAlias.IntelligenceLanguageModelLoader) | Represents a factory responsible for creating a configured language model instance. |
|
|
40
|
+
| [IntelligenceLanguageModelLoaders](TypeAlias.IntelligenceLanguageModelLoaders) | Maps configured intelligence providers to their tree-shakable model loader. |
|
|
55
41
|
| [IntelligenceProviderName](TypeAlias.IntelligenceProviderName) | Represents the union of supported intelligence provider identifiers. |
|
|
42
|
+
| [IntelligenceTextStream](TypeAlias.IntelligenceTextStream) | Native AI SDK streaming result returned by the intelligence text generator. |
|
|
56
43
|
|
|
57
44
|
## Variables
|
|
58
45
|
|
|
@@ -60,11 +47,17 @@ editUrl: false
|
|
|
60
47
|
| ------ | ------ |
|
|
61
48
|
| [ANTHROPIC\_API\_KEY](Variable.ANTHROPIC_API_KEY) | Anthropic-specific API key. |
|
|
62
49
|
| [ANTHROPIC\_BASE\_URL](Variable.ANTHROPIC_BASE_URL) | Anthropic-specific base URL. |
|
|
63
|
-
| [
|
|
50
|
+
| [ANTHROPIC\_CONFIG\_ENTRIES](Variable.ANTHROPIC_CONFIG_ENTRIES) | Configuration entries used by the Anthropic intelligence provider. |
|
|
51
|
+
| [AnthropicIntelligenceToolNames](Variable.AnthropicIntelligenceToolNames) | Anthropic provider-defined tool names exposed through Archipel. |
|
|
52
|
+
| [GEMINI\_API\_KEY](Variable.GEMINI_API_KEY) | Google-specific Gemini API key alias. |
|
|
64
53
|
| [GOOGLE\_API\_KEY](Variable.GOOGLE_API_KEY) | Google-specific API key. |
|
|
65
54
|
| [GOOGLE\_BASE\_URL](Variable.GOOGLE_BASE_URL) | Google-specific base URL. |
|
|
55
|
+
| [GOOGLE\_CONFIG\_ENTRIES](Variable.GOOGLE_CONFIG_ENTRIES) | Configuration entries used by the Google intelligence provider. |
|
|
56
|
+
| [GoogleIntelligenceToolNames](Variable.GoogleIntelligenceToolNames) | Google provider-defined tool names exposed through Archipel. |
|
|
66
57
|
| [GROK\_API\_KEY](Variable.GROK_API_KEY) | Grok-specific API key. |
|
|
67
58
|
| [GROK\_BASE\_URL](Variable.GROK_BASE_URL) | Grok-specific base URL. |
|
|
59
|
+
| [GROK\_CONFIG\_ENTRIES](Variable.GROK_CONFIG_ENTRIES) | Configuration entries used by the Grok intelligence provider. |
|
|
60
|
+
| [GrokIntelligenceToolNames](Variable.GrokIntelligenceToolNames) | Grok provider-defined tool names exposed through Archipel. |
|
|
68
61
|
| [INTELLIGENCE\_API\_KEY](Variable.INTELLIGENCE_API_KEY) | Global API key override for the intelligence provider. |
|
|
69
62
|
| [INTELLIGENCE\_BASE\_URL](Variable.INTELLIGENCE_BASE_URL) | Global base URL override for the intelligence provider. |
|
|
70
63
|
| [INTELLIGENCE\_MAX\_OUTPUT\_TOKENS](Variable.INTELLIGENCE_MAX_OUTPUT_TOKENS) | Maximum number of output tokens for the AI model. |
|
|
@@ -72,21 +65,67 @@ editUrl: false
|
|
|
72
65
|
| [INTELLIGENCE\_PROVIDER](Variable.INTELLIGENCE_PROVIDER) | Intelligence provider name (e.g. openai, anthropic, google, grok). |
|
|
73
66
|
| [INTELLIGENCE\_TEMPERATURE](Variable.INTELLIGENCE_TEMPERATURE) | Sampling temperature for the AI model. |
|
|
74
67
|
| [INTELLIGENCE\_TOP\_P](Variable.INTELLIGENCE_TOP_P) | Top-p (nucleus sampling) for the AI model. |
|
|
75
|
-
| [IntelligenceConversationMessageRoles](Variable.IntelligenceConversationMessageRoles) | Enumerates the conversation roles used for contextual snapshots and messages. |
|
|
76
68
|
| [IntelligenceProviderNames](Variable.IntelligenceProviderNames) | Enumerates the supported model providers powering the intelligence pipeline. |
|
|
77
69
|
| [OPENAI\_API\_KEY](Variable.OPENAI_API_KEY) | OpenAI-specific API key. |
|
|
78
70
|
| [OPENAI\_BASE\_URL](Variable.OPENAI_BASE_URL) | OpenAI-specific base URL. |
|
|
71
|
+
| [OPENAI\_CONFIG\_ENTRIES](Variable.OPENAI_CONFIG_ENTRIES) | Configuration entries used by the OpenAI intelligence provider. |
|
|
72
|
+
| [OpenAIIntelligenceToolNames](Variable.OpenAIIntelligenceToolNames) | OpenAI provider-defined tool names exposed through Archipel. |
|
|
79
73
|
| [PLATFORM\_INTELLIGENCE\_CONFIG\_ENTRIES](Variable.PLATFORM_INTELLIGENCE_CONFIG_ENTRIES) | All configuration entries required by `platform-intelligence`. |
|
|
80
|
-
| [XAI\_API\_KEY](Variable.XAI_API_KEY) |
|
|
81
|
-
| [XAI\_BASE\_URL](Variable.XAI_BASE_URL) |
|
|
74
|
+
| [XAI\_API\_KEY](Variable.XAI_API_KEY) | xAI-specific API key alias for Grok. |
|
|
75
|
+
| [XAI\_BASE\_URL](Variable.XAI_BASE_URL) | xAI-specific base URL alias for Grok. |
|
|
82
76
|
|
|
83
77
|
## Functions
|
|
84
78
|
|
|
85
79
|
| Function | Description |
|
|
86
80
|
| ------ | ------ |
|
|
81
|
+
| [createAnthropicAdvisor20260301Tool](Function.createAnthropicAdvisor20260301Tool) | Creates an Anthropic advisor tool registration. |
|
|
82
|
+
| [createAnthropicBash20241022Tool](Function.createAnthropicBash20241022Tool) | Creates an Anthropic bash tool registration for the 2024-10-22 version. |
|
|
83
|
+
| [createAnthropicBash20250124Tool](Function.createAnthropicBash20250124Tool) | Creates an Anthropic bash tool registration for the 2025-01-24 version. |
|
|
84
|
+
| [createAnthropicCodeExecution20250522Tool](Function.createAnthropicCodeExecution20250522Tool) | Creates an Anthropic code-execution tool registration for the 2025-05-22 version. |
|
|
85
|
+
| [createAnthropicCodeExecution20250825Tool](Function.createAnthropicCodeExecution20250825Tool) | Creates an Anthropic code-execution tool registration for the 2025-08-25 version. |
|
|
86
|
+
| [createAnthropicCodeExecution20260120Tool](Function.createAnthropicCodeExecution20260120Tool) | Creates an Anthropic code-execution tool registration for the 2026-01-20 version. |
|
|
87
|
+
| [createAnthropicComputer20241022Tool](Function.createAnthropicComputer20241022Tool) | Creates an Anthropic computer-use tool registration for the 2024-10-22 version. |
|
|
88
|
+
| [createAnthropicComputer20250124Tool](Function.createAnthropicComputer20250124Tool) | Creates an Anthropic computer-use tool registration for the 2025-01-24 version. |
|
|
89
|
+
| [createAnthropicComputer20251124Tool](Function.createAnthropicComputer20251124Tool) | Creates an Anthropic computer-use tool registration for the 2025-11-24 version. |
|
|
90
|
+
| [createAnthropicMemory20250818Tool](Function.createAnthropicMemory20250818Tool) | Creates an Anthropic memory tool registration. |
|
|
91
|
+
| [createAnthropicTextEditor20241022Tool](Function.createAnthropicTextEditor20241022Tool) | Creates an Anthropic text-editor tool registration for the 2024-10-22 version. |
|
|
92
|
+
| [createAnthropicTextEditor20250124Tool](Function.createAnthropicTextEditor20250124Tool) | Creates an Anthropic text-editor tool registration for the 2025-01-24 version. |
|
|
93
|
+
| [createAnthropicTextEditor20250429Tool](Function.createAnthropicTextEditor20250429Tool) | Creates an Anthropic text-editor tool registration for the 2025-04-29 version. |
|
|
94
|
+
| [createAnthropicTextEditor20250728Tool](Function.createAnthropicTextEditor20250728Tool) | Creates an Anthropic text-editor tool registration for the 2025-07-28 version. |
|
|
95
|
+
| [createAnthropicToolSearchBM2520251119Tool](Function.createAnthropicToolSearchBM2520251119Tool) | Creates an Anthropic BM25 tool-search tool registration. |
|
|
96
|
+
| [createAnthropicToolSearchRegex20251119Tool](Function.createAnthropicToolSearchRegex20251119Tool) | Creates an Anthropic regex tool-search tool registration. |
|
|
97
|
+
| [createAnthropicWebFetch20250910Tool](Function.createAnthropicWebFetch20250910Tool) | Creates an Anthropic web-fetch tool registration for the 2025-09-10 version. |
|
|
98
|
+
| [createAnthropicWebFetch20260209Tool](Function.createAnthropicWebFetch20260209Tool) | Creates an Anthropic web-fetch tool registration for the 2026-02-09 version. |
|
|
99
|
+
| [createAnthropicWebSearch20250305Tool](Function.createAnthropicWebSearch20250305Tool) | Creates an Anthropic web-search tool registration for the 2025-03-05 version. |
|
|
100
|
+
| [createAnthropicWebSearch20260209Tool](Function.createAnthropicWebSearch20260209Tool) | Creates an Anthropic web-search tool registration for the 2026-02-09 version. |
|
|
101
|
+
| [createGoogleCodeExecutionTool](Function.createGoogleCodeExecutionTool) | Creates a Google code-execution tool registration. |
|
|
102
|
+
| [createGoogleEnterpriseWebSearchTool](Function.createGoogleEnterpriseWebSearchTool) | Creates a Google enterprise-web-search tool registration. |
|
|
103
|
+
| [createGoogleFileSearchTool](Function.createGoogleFileSearchTool) | Creates a Google file-search tool registration. |
|
|
104
|
+
| [createGoogleGoogleMapsTool](Function.createGoogleGoogleMapsTool) | Creates a Google Maps grounding tool registration. |
|
|
105
|
+
| [createGoogleGoogleSearchTool](Function.createGoogleGoogleSearchTool) | Creates a Google Search grounding tool registration. |
|
|
106
|
+
| [createGoogleUrlContextTool](Function.createGoogleUrlContextTool) | Creates a Google URL context tool registration. |
|
|
107
|
+
| [createGoogleVertexRagStoreTool](Function.createGoogleVertexRagStoreTool) | Creates a Google Vertex RAG Store tool registration. |
|
|
108
|
+
| [createGrokCodeExecutionTool](Function.createGrokCodeExecutionTool) | Creates a Grok code-execution tool registration. |
|
|
109
|
+
| [createGrokFileSearchTool](Function.createGrokFileSearchTool) | Creates a Grok file-search tool registration. |
|
|
110
|
+
| [createGrokMcpServerTool](Function.createGrokMcpServerTool) | Creates a Grok MCP server tool registration. |
|
|
111
|
+
| [createGrokViewImageTool](Function.createGrokViewImageTool) | Creates a Grok image-understanding tool registration. |
|
|
112
|
+
| [createGrokViewXVideoTool](Function.createGrokViewXVideoTool) | Creates a Grok X-video understanding tool registration. |
|
|
113
|
+
| [createGrokWebSearchTool](Function.createGrokWebSearchTool) | Creates a Grok web-search tool registration. |
|
|
114
|
+
| [createGrokXSearchTool](Function.createGrokXSearchTool) | Creates a Grok X-search tool registration. |
|
|
115
|
+
| [createIntelligenceTool](Function.createIntelligenceTool) | Adapts a native AI SDK tool to the Archipel intelligence tool schema. |
|
|
116
|
+
| [createOpenAIApplyPatchTool](Function.createOpenAIApplyPatchTool) | Creates an OpenAI apply-patch tool registration. |
|
|
117
|
+
| [createOpenAICodeInterpreterTool](Function.createOpenAICodeInterpreterTool) | Creates an OpenAI code-interpreter tool registration. |
|
|
118
|
+
| [createOpenAICustomTool](Function.createOpenAICustomTool) | Creates an OpenAI custom provider-defined tool registration. |
|
|
119
|
+
| [createOpenAIFileSearchTool](Function.createOpenAIFileSearchTool) | Creates an OpenAI file-search tool registration. |
|
|
120
|
+
| [createOpenAIImageGenerationTool](Function.createOpenAIImageGenerationTool) | Creates an OpenAI image-generation tool registration. |
|
|
121
|
+
| [createOpenAILocalShellTool](Function.createOpenAILocalShellTool) | Creates an OpenAI local-shell tool registration. |
|
|
122
|
+
| [createOpenAIMcpTool](Function.createOpenAIMcpTool) | Creates an OpenAI MCP connector tool registration. |
|
|
123
|
+
| [createOpenAIShellTool](Function.createOpenAIShellTool) | Creates an OpenAI shell tool registration. |
|
|
124
|
+
| [createOpenAIToolSearchTool](Function.createOpenAIToolSearchTool) | Creates an OpenAI tool-search tool registration. |
|
|
125
|
+
| [createOpenAIWebSearchPreviewTool](Function.createOpenAIWebSearchPreviewTool) | Creates an OpenAI web-search-preview tool registration. |
|
|
126
|
+
| [createOpenAIWebSearchTool](Function.createOpenAIWebSearchTool) | Creates an OpenAI web-search tool registration. |
|
|
87
127
|
| [createProviderOptions](Function.createProviderOptions) | Creates the provider options object consumed by the AI SDK model factories. |
|
|
88
|
-
| [loadAnthropicLanguageModel](Function.loadAnthropicLanguageModel) |
|
|
89
|
-
| [loadGoogleLanguageModel](Function.loadGoogleLanguageModel) |
|
|
90
|
-
| [loadGrokLanguageModel](Function.loadGrokLanguageModel) |
|
|
91
|
-
| [loadOpenAILanguageModel](Function.loadOpenAILanguageModel) |
|
|
92
|
-
| [loadProviderFactory](Function.loadProviderFactory) | Dynamically loads an AI SDK provider factory and returns the exported function reference. |
|
|
128
|
+
| [loadAnthropicLanguageModel](Function.loadAnthropicLanguageModel) | Creates the Anthropic language model from the resolved provider configuration. |
|
|
129
|
+
| [loadGoogleLanguageModel](Function.loadGoogleLanguageModel) | Creates the Google Gemini language model from the resolved provider configuration. |
|
|
130
|
+
| [loadGrokLanguageModel](Function.loadGrokLanguageModel) | Creates the Grok language model through the native xAI provider. |
|
|
131
|
+
| [loadOpenAILanguageModel](Function.loadOpenAILanguageModel) | Creates the OpenAI language model from the resolved provider configuration. |
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: platform-intelligence
|
|
3
|
-
description: Multi-provider AI text generation
|
|
3
|
+
description: Multi-provider AI text generation, streaming, and tool calling.
|
|
4
4
|
order: 16
|
|
5
|
-
tags: [intelligence, ai, openai, anthropic, google, grok, text-generation,
|
|
5
|
+
tags: [intelligence, ai, openai, anthropic, google, grok, text-generation, streaming, tool-calling, health]
|
|
6
6
|
package: '@breadstone/archipel-platform-intelligence'
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# platform-intelligence
|
|
10
10
|
|
|
11
|
-
Multi-provider AI text generation library supporting OpenAI, Anthropic, Google Generative AI, and Grok.
|
|
11
|
+
Multi-provider AI text generation library supporting OpenAI, Anthropic, Google Generative AI, and Grok. Tool orchestration is delegated to the AI SDK through native and provider-defined tool definitions, `toolChoice`, `activeTools`, and `stopWhen`. Advanced use cases can pass native AI SDK prompts, request-level models, provider options, headers, telemetry, output settings, and step hooks through the platform generator.
|
|
12
12
|
|
|
13
13
|
**Package:** `@breadstone/archipel-platform-intelligence`
|
|
14
14
|
|
|
@@ -18,101 +18,308 @@ Multi-provider AI text generation library supporting OpenAI, Anthropic, Google G
|
|
|
18
18
|
|
|
19
19
|
```typescript
|
|
20
20
|
import { Module } from '@nestjs/common';
|
|
21
|
-
import { IntelligenceModule } from '@breadstone/archipel-platform-intelligence';
|
|
21
|
+
import { IntelligenceModule, IntelligenceProviderNames } from '@breadstone/archipel-platform-intelligence';
|
|
22
|
+
import { loadOpenAILanguageModel } from '@breadstone/archipel-platform-intelligence/providers/openai';
|
|
22
23
|
|
|
23
24
|
@Module({
|
|
24
|
-
imports: [
|
|
25
|
+
imports: [
|
|
26
|
+
IntelligenceModule.register({
|
|
27
|
+
providerLoaders: {
|
|
28
|
+
[IntelligenceProviderNames.OpenAI]: loadOpenAILanguageModel,
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
25
32
|
})
|
|
26
33
|
export class AppModule {}
|
|
27
34
|
```
|
|
28
35
|
|
|
29
36
|
---
|
|
30
37
|
|
|
31
|
-
## Provider
|
|
38
|
+
## Provider Subpaths
|
|
32
39
|
|
|
33
|
-
|
|
40
|
+
Import only the providers you need:
|
|
34
41
|
|
|
35
|
-
| Provider |
|
|
36
|
-
| --------- |
|
|
37
|
-
| OpenAI | `@breadstone/archipel-platform-intelligence/openai` |
|
|
38
|
-
| Anthropic | `@breadstone/archipel-platform-intelligence/anthropic` |
|
|
39
|
-
| Google | `@breadstone/archipel-platform-intelligence/google` |
|
|
40
|
-
| Grok | `@breadstone/archipel-platform-intelligence/grok` |
|
|
42
|
+
| Provider | Subpath |
|
|
43
|
+
| --------- | ---------------------------------------------------------------- |
|
|
44
|
+
| OpenAI | `@breadstone/archipel-platform-intelligence/providers/openai` |
|
|
45
|
+
| Anthropic | `@breadstone/archipel-platform-intelligence/providers/anthropic` |
|
|
46
|
+
| Google | `@breadstone/archipel-platform-intelligence/providers/google` |
|
|
47
|
+
| Grok | `@breadstone/archipel-platform-intelligence/providers/grok` |
|
|
48
|
+
|
|
49
|
+
Provider-native tool wrappers are exported through matching `/tools` subpaths, for example `@breadstone/archipel-platform-intelligence/providers/grok/tools`.
|
|
41
50
|
|
|
42
51
|
---
|
|
43
52
|
|
|
44
|
-
##
|
|
53
|
+
## Tool Registration
|
|
45
54
|
|
|
46
|
-
|
|
55
|
+
Tools can be normal Nest providers or direct `IIntelligenceTool` instances. Register classes for custom application tools, or register provider-native wrappers from provider subpaths.
|
|
47
56
|
|
|
48
57
|
```typescript
|
|
49
|
-
import { Injectable } from '@nestjs/common';
|
|
50
|
-
import {
|
|
58
|
+
import { Injectable, Module } from '@nestjs/common';
|
|
59
|
+
import { tool, type Tool } from 'ai';
|
|
60
|
+
import { z } from 'zod';
|
|
61
|
+
import { IntelligenceModule, IntelligenceProviderNames, IntelligenceToolBase } from '@breadstone/archipel-platform-intelligence';
|
|
62
|
+
import { loadOpenAILanguageModel } from '@breadstone/archipel-platform-intelligence/providers/openai';
|
|
63
|
+
|
|
64
|
+
interface ICustomerSearchInput {
|
|
65
|
+
readonly query: string;
|
|
66
|
+
}
|
|
51
67
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
68
|
+
interface ICustomerSearchOutput {
|
|
69
|
+
readonly customers: ReadonlyArray<string>;
|
|
70
|
+
}
|
|
55
71
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
72
|
+
@Injectable()
|
|
73
|
+
export class CustomerSearchTool extends IntelligenceToolBase<ICustomerSearchInput, ICustomerSearchOutput> {
|
|
74
|
+
public override get name(): string {
|
|
75
|
+
return 'searchCustomers';
|
|
76
|
+
}
|
|
61
77
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
78
|
+
public override get tool(): Tool<ICustomerSearchInput, ICustomerSearchOutput> {
|
|
79
|
+
return tool({
|
|
80
|
+
description: 'Searches customers by name, email, or company.',
|
|
81
|
+
inputSchema: z.object({
|
|
82
|
+
query: z.string().describe('Customer search query'),
|
|
83
|
+
}),
|
|
84
|
+
execute: async (input) => ({ customers: [input.query] }),
|
|
66
85
|
});
|
|
67
|
-
|
|
68
|
-
return result.text;
|
|
69
86
|
}
|
|
70
87
|
}
|
|
88
|
+
|
|
89
|
+
@Module({
|
|
90
|
+
imports: [
|
|
91
|
+
IntelligenceModule.register({
|
|
92
|
+
providerLoaders: {
|
|
93
|
+
[IntelligenceProviderNames.OpenAI]: loadOpenAILanguageModel,
|
|
94
|
+
},
|
|
95
|
+
tools: [CustomerSearchTool],
|
|
96
|
+
}),
|
|
97
|
+
],
|
|
98
|
+
})
|
|
99
|
+
export class AppModule {}
|
|
71
100
|
```
|
|
72
101
|
|
|
73
|
-
|
|
102
|
+
### Provider-Native Tools
|
|
103
|
+
|
|
104
|
+
Provider SDKs expose built-in tools such as web search, file search, code execution, and URL context. Archipel exports wrappers from provider subpaths so each tool is compatible with `IIntelligenceTool` without importing unused provider SDKs from the root entry.
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { Module } from '@nestjs/common';
|
|
108
|
+
import { IntelligenceModule, IntelligenceProviderNames } from '@breadstone/archipel-platform-intelligence';
|
|
109
|
+
import { loadOpenAILanguageModel } from '@breadstone/archipel-platform-intelligence/providers/openai';
|
|
110
|
+
import { createOpenAIWebSearchTool } from '@breadstone/archipel-platform-intelligence/providers/openai/tools';
|
|
74
111
|
|
|
75
|
-
|
|
112
|
+
@Module({
|
|
113
|
+
imports: [
|
|
114
|
+
IntelligenceModule.register({
|
|
115
|
+
providerLoaders: {
|
|
116
|
+
[IntelligenceProviderNames.OpenAI]: loadOpenAILanguageModel,
|
|
117
|
+
},
|
|
118
|
+
tools: [createOpenAIWebSearchTool({ searchContextSize: 'medium' })],
|
|
119
|
+
}),
|
|
120
|
+
],
|
|
121
|
+
})
|
|
122
|
+
export class AppModule {}
|
|
123
|
+
```
|
|
76
124
|
|
|
77
|
-
|
|
125
|
+
Provider-native wrappers cover OpenAI web search, file search, code interpreter, image generation, shell, MCP, and tool search; Google Search, Enterprise Web Search, URL Context, Code Execution, File Search, Maps, and Vertex RAG Store; versioned Anthropic web search, web fetch, code execution, bash, text editor, computer, memory, tool search, and advisor tools; and Grok web search, X search, file search, code execution, MCP, image understanding, and X-video understanding.
|
|
78
126
|
|
|
79
|
-
|
|
127
|
+
The detailed AI text generation guide includes OpenAI recipes for spreadsheet analysis with Code Interpreter, image generation with generated files, deferred tool loading via Tool Search, and grammar-constrained custom tools. In the currently installed OpenAI SDK, `customTool()` constrains provider output but does not run a local `execute` callback; use a normal `tool()` when local execution is required.
|
|
128
|
+
|
|
129
|
+
### Native AI SDK Passthrough
|
|
130
|
+
|
|
131
|
+
`generateText()` and `streamText()` accept native AI SDK `Prompt` objects directly. The options intentionally extend the native AI SDK call options, so provider-specific features can flow through even when Archipel has no dedicated wrapper for them.
|
|
132
|
+
|
|
133
|
+
The configured platform model is used by default. For exact AI SDK model factories, pass `model` per request. When every call provides a native model, set `validateOnModuleInit: false` to skip startup validation of platform provider configuration.
|
|
80
134
|
|
|
81
135
|
```typescript
|
|
82
|
-
import {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
136
|
+
import { openai } from '@ai-sdk/openai';
|
|
137
|
+
import { Injectable, Module } from '@nestjs/common';
|
|
138
|
+
import { IntelligenceModule, IntelligenceTextGenerator } from '@breadstone/archipel-platform-intelligence';
|
|
139
|
+
|
|
140
|
+
@Module({
|
|
141
|
+
imports: [
|
|
142
|
+
IntelligenceModule.register({
|
|
143
|
+
validateOnModuleInit: false,
|
|
144
|
+
}),
|
|
145
|
+
],
|
|
146
|
+
})
|
|
147
|
+
export class RawAiSdkModule {}
|
|
148
|
+
|
|
149
|
+
@Injectable()
|
|
150
|
+
export class RawAiSdkRecipeService {
|
|
151
|
+
public constructor(private readonly _textGenerator: IntelligenceTextGenerator) {}
|
|
152
|
+
|
|
153
|
+
public async answerWithNativeOptions(): Promise<string> {
|
|
154
|
+
const completion = await this._textGenerator.generateText(
|
|
155
|
+
{
|
|
156
|
+
system: 'Answer concisely and include assumptions.',
|
|
157
|
+
prompt: 'Compare the operational risks of outdoor work tomorrow.',
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
model: openai.responses('gpt-5'),
|
|
161
|
+
headers: { 'x-use-case': 'outdoor-risk' },
|
|
162
|
+
providerOptions: {
|
|
163
|
+
openai: {
|
|
164
|
+
reasoningEffort: 'medium',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
seed: 42,
|
|
168
|
+
},
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
return completion.text;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
91
174
|
```
|
|
92
175
|
|
|
93
|
-
###
|
|
176
|
+
### Outdoor Order Weather Risk Example
|
|
177
|
+
|
|
178
|
+
Use a class-based application tool for tenant data and a provider-native web search tool for current weather context. Set `INTELLIGENCE_PROVIDER=openai` and `INTELLIGENCE_MODEL=gpt-5` in configuration when this flow should use GPT-5.
|
|
94
179
|
|
|
95
180
|
```typescript
|
|
96
|
-
import { Injectable } from '@nestjs/common';
|
|
181
|
+
import { Injectable, Module } from '@nestjs/common';
|
|
182
|
+
import { stepCountIs, tool, type Tool } from 'ai';
|
|
183
|
+
import { z } from 'zod';
|
|
97
184
|
import {
|
|
98
|
-
|
|
99
|
-
|
|
185
|
+
IntelligenceModule,
|
|
186
|
+
IntelligenceProviderNames,
|
|
187
|
+
IntelligenceTextGenerator,
|
|
188
|
+
IntelligenceToolBase,
|
|
189
|
+
type IIntelligenceTextCompletion,
|
|
100
190
|
} from '@breadstone/archipel-platform-intelligence';
|
|
191
|
+
import { OpenAIIntelligenceToolNames, loadOpenAILanguageModel } from '@breadstone/archipel-platform-intelligence/providers/openai';
|
|
192
|
+
import { createOpenAIWebSearchTool } from '@breadstone/archipel-platform-intelligence/providers/openai/tools';
|
|
193
|
+
|
|
194
|
+
interface IOutdoorOrderLookupInput {
|
|
195
|
+
readonly date: string;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
interface IOutdoorOrderLookupOutput {
|
|
199
|
+
readonly date: string;
|
|
200
|
+
readonly orders: ReadonlyArray<{
|
|
201
|
+
readonly id: string;
|
|
202
|
+
readonly location: string;
|
|
203
|
+
readonly scheduledAt: string;
|
|
204
|
+
readonly outdoorWork: boolean;
|
|
205
|
+
}>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@Injectable()
|
|
209
|
+
export class OutdoorOrdersTool extends IntelligenceToolBase<IOutdoorOrderLookupInput, IOutdoorOrderLookupOutput> {
|
|
210
|
+
public override get name(): string {
|
|
211
|
+
return 'get_outdoor_orders';
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
public override get tool(): Tool<IOutdoorOrderLookupInput, IOutdoorOrderLookupOutput> {
|
|
215
|
+
return tool({
|
|
216
|
+
description: 'Returns outdoor field orders for the current tenant and date.',
|
|
217
|
+
inputSchema: z.object({
|
|
218
|
+
date: z.string().describe('Date in YYYY-MM-DD format'),
|
|
219
|
+
}),
|
|
220
|
+
execute: async (input: IOutdoorOrderLookupInput) => ({
|
|
221
|
+
date: input.date,
|
|
222
|
+
orders: [
|
|
223
|
+
{
|
|
224
|
+
id: 'ord_4711',
|
|
225
|
+
location: 'Berlin',
|
|
226
|
+
scheduledAt: `${input.date}T08:00:00+02:00`,
|
|
227
|
+
outdoorWork: true,
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
|
+
}),
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
@Injectable()
|
|
236
|
+
export class OutdoorOrderRiskAnalysisService {
|
|
237
|
+
public constructor(private readonly _textGenerator: IntelligenceTextGenerator) {}
|
|
238
|
+
|
|
239
|
+
public async analyseOutdoorOrders(date: string): Promise<{ readonly text: string; readonly sources: IIntelligenceTextCompletion['sources'] }> {
|
|
240
|
+
const result = await this._textGenerator.generateText(
|
|
241
|
+
{
|
|
242
|
+
system: 'You assess weather-related risks for tenant outdoor field orders.',
|
|
243
|
+
messages: [{ role: 'user', content: `Review outdoor field orders for ${date} and flag weather-related risks.` }],
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
toolChoice: 'auto',
|
|
247
|
+
activeTools: ['get_outdoor_orders', OpenAIIntelligenceToolNames.WebSearch],
|
|
248
|
+
stopWhen: stepCountIs(3),
|
|
249
|
+
},
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
return {
|
|
253
|
+
text: result.text,
|
|
254
|
+
sources: result.sources,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
@Module({
|
|
260
|
+
imports: [
|
|
261
|
+
IntelligenceModule.register({
|
|
262
|
+
providerLoaders: {
|
|
263
|
+
[IntelligenceProviderNames.OpenAI]: loadOpenAILanguageModel,
|
|
264
|
+
},
|
|
265
|
+
tools: [
|
|
266
|
+
OutdoorOrdersTool,
|
|
267
|
+
createOpenAIWebSearchTool({
|
|
268
|
+
externalWebAccess: true,
|
|
269
|
+
searchContextSize: 'medium',
|
|
270
|
+
filters: { allowedDomains: ['dwd.de'] },
|
|
271
|
+
}),
|
|
272
|
+
],
|
|
273
|
+
}),
|
|
274
|
+
],
|
|
275
|
+
providers: [OutdoorOrderRiskAnalysisService],
|
|
276
|
+
})
|
|
277
|
+
export class OutdoorOrderRiskAnalysisModule {}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Text Generation
|
|
283
|
+
|
|
284
|
+
Inject `IntelligenceTextGenerator` and call `generateText()`:
|
|
285
|
+
|
|
286
|
+
```typescript
|
|
287
|
+
import { Injectable } from '@nestjs/common';
|
|
288
|
+
import type { Prompt } from 'ai';
|
|
289
|
+
import { IntelligenceTextGenerator } from '@breadstone/archipel-platform-intelligence';
|
|
101
290
|
|
|
102
291
|
@Injectable()
|
|
103
|
-
export class
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
292
|
+
export class SummaryService {
|
|
293
|
+
constructor(private readonly _textGenerator: IntelligenceTextGenerator) {}
|
|
294
|
+
|
|
295
|
+
async summarize(content: string): Promise<string> {
|
|
296
|
+
const prompt: Prompt = {
|
|
297
|
+
system: 'You are a concise summarizer.',
|
|
298
|
+
messages: [{ role: 'user', content }],
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
const result = await this._textGenerator.generateText(prompt, {
|
|
302
|
+
temperature: 0.3,
|
|
303
|
+
toolChoice: 'auto',
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
return result.text;
|
|
107
307
|
}
|
|
108
308
|
}
|
|
109
309
|
```
|
|
110
310
|
|
|
111
|
-
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Streaming
|
|
314
|
+
`streamText()` uses the same registered tools and returns the native AI SDK stream result.
|
|
112
315
|
|
|
113
316
|
```typescript
|
|
114
|
-
const
|
|
115
|
-
|
|
317
|
+
const stream = await this._textGenerator.streamText(prompt, {
|
|
318
|
+
activeTools: ['searchCustomers'],
|
|
319
|
+
stopWhen: stepCountIs(3),
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
return stream.toUIMessageStreamResponse();
|
|
116
323
|
```
|
|
117
324
|
|
|
118
325
|
---
|
|
@@ -121,10 +328,10 @@ const result = await this._textGenerator.generateText(prompt, capability);
|
|
|
121
328
|
|
|
122
329
|
| Variable | Description | Required |
|
|
123
330
|
| -------------------------------- | ---------------------------- | ------------------ |
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
331
|
+
| `OPENAI_API_KEY` | OpenAI API key | If using OpenAI |
|
|
332
|
+
| `ANTHROPIC_API_KEY` | Anthropic API key | If using Anthropic |
|
|
333
|
+
| `GOOGLE_API_KEY` | Google Generative AI API key | If using Google |
|
|
334
|
+
| `GROK_API_KEY` | Grok / xAI API key | If using Grok |
|
|
128
335
|
|
|
129
336
|
---
|
|
130
337
|
|
|
@@ -142,9 +349,7 @@ Override the timeout per call via the options parameter:
|
|
|
142
349
|
|
|
143
350
|
```typescript
|
|
144
351
|
const result = await this._textGenerator.generateText(prompt, {
|
|
145
|
-
|
|
146
|
-
model: 'gpt-4o',
|
|
147
|
-
timeoutMs: 15_000, // 15-second timeout
|
|
352
|
+
timeoutMs: 15_000,
|
|
148
353
|
});
|
|
149
354
|
```
|
|
150
355
|
|
|
@@ -160,7 +365,7 @@ The library provides three domain error classes for different failure scenarios:
|
|
|
160
365
|
| ---------------------------------- | ----------------------------- | --------------------------------------------------------------------- |
|
|
161
366
|
| `IntelligenceProviderError` | `INTELLIGENCE_PROVIDER` | Provider SDK failures during text generation |
|
|
162
367
|
| `IntelligenceValidationError` | `INTELLIGENCE_VALIDATION` | Invalid generation parameters (temperature, topP, maxOutputTokens) |
|
|
163
|
-
| `IntelligenceConfigurationError` | `INTELLIGENCE_CONFIGURATION` | Unsupported provider, missing API key, or missing
|
|
368
|
+
| `IntelligenceConfigurationError` | `INTELLIGENCE_CONFIGURATION` | Unsupported provider, missing API key, or missing provider loader |
|
|
164
369
|
|
|
165
370
|
```typescript
|
|
166
371
|
import {
|
|
@@ -174,27 +379,33 @@ import {
|
|
|
174
379
|
|
|
175
380
|
## Lifecycle
|
|
176
381
|
|
|
177
|
-
`IntelligenceTextGenerator` implements `OnModuleInit` and validates the provider configuration eagerly at startup. Missing API keys
|
|
382
|
+
`IntelligenceTextGenerator` implements `OnModuleInit` and validates the provider configuration plus registered provider loader eagerly at startup. Missing API keys, unsupported providers, or missing loaders throw `IntelligenceConfigurationError` before the first request is processed.
|
|
178
383
|
|
|
179
384
|
---
|
|
180
385
|
|
|
181
|
-
##
|
|
386
|
+
## Tool Registry Limits
|
|
182
387
|
|
|
183
|
-
`
|
|
388
|
+
`IntelligenceToolRegistry` enforces a maximum of **128** registered tools. Attempts to register beyond this limit throw `IntelligenceValidationError` to prevent unbounded memory growth.
|
|
184
389
|
|
|
185
390
|
---
|
|
186
391
|
|
|
187
392
|
## Health Check
|
|
188
393
|
|
|
189
|
-
The `IntelligenceHealthIndicator` verifies that
|
|
394
|
+
The `IntelligenceHealthIndicator` verifies that provider configuration can be resolved. If no text generator is available, it reports `disabled: true`. Import it from the `/health` subpath:
|
|
190
395
|
|
|
191
396
|
```typescript
|
|
397
|
+
import { IntelligenceModule, IntelligenceProviderNames } from '@breadstone/archipel-platform-intelligence';
|
|
192
398
|
import { IntelligenceHealthIndicator } from '@breadstone/archipel-platform-intelligence/health';
|
|
399
|
+
import { loadOpenAILanguageModel } from '@breadstone/archipel-platform-intelligence/providers/openai';
|
|
193
400
|
import { HealthModule } from '@breadstone/archipel-platform-health';
|
|
194
401
|
|
|
195
402
|
@Module({
|
|
196
403
|
imports: [
|
|
197
|
-
IntelligenceModule.register({
|
|
404
|
+
IntelligenceModule.register({
|
|
405
|
+
providerLoaders: {
|
|
406
|
+
[IntelligenceProviderNames.OpenAI]: loadOpenAILanguageModel,
|
|
407
|
+
},
|
|
408
|
+
}),
|
|
198
409
|
HealthModule.withIndicators([IntelligenceHealthIndicator]),
|
|
199
410
|
],
|
|
200
411
|
})
|
|
@@ -203,7 +414,7 @@ export class AppModule {}
|
|
|
203
414
|
|
|
204
415
|
| Key | Check | Dependencies |
|
|
205
416
|
| --- | ----- | ------------ |
|
|
206
|
-
| `intelligence` | `up`
|
|
417
|
+
| `intelligence` | `up` when provider configuration resolves, else `down` | `@Optional() IntelligenceTextGenerator` |
|
|
207
418
|
|
|
208
419
|
---
|
|
209
420
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@breadstone/archipel-mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.45",
|
|
4
4
|
"description": "MCP server providing Archipel platform knowledge - documentation, query patterns, and coding conventions - to AI development tools.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/main.js",
|