@promptbook/google 0.100.0-4 → 0.100.0-40
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/README.md +1 -0
- package/esm/index.es.js +46 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +4 -0
- package/esm/typings/src/_packages/core.index.d.ts +26 -0
- package/esm/typings/src/_packages/types.index.d.ts +30 -0
- package/esm/typings/src/book-2.0/agent-source/parseAgentSource.d.ts +30 -0
- package/esm/typings/src/book-2.0/agent-source/parseAgentSource.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +26 -0
- package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +38 -0
- package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +39 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/FrontendRAGService.d.ts +48 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +51 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/RAGService.d.ts +54 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/BaseKnowledgeProcessor.d.ts +45 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/PdfProcessor.d.ts +31 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/ProcessorFactory.d.ts +23 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/TextProcessor.d.ts +18 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/types.d.ts +56 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/utils/ragHelper.d.ts +34 -0
- package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +44 -0
- package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +56 -0
- package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +39 -0
- package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +49 -0
- package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +46 -0
- package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +44 -0
- package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +44 -0
- package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +38 -0
- package/esm/typings/src/book-2.0/commitments/_base/BaseCommitmentDefinition.d.ts +52 -0
- package/esm/typings/src/book-2.0/commitments/_base/BookCommitment.d.ts +5 -0
- package/esm/typings/src/book-2.0/commitments/_base/CommitmentDefinition.d.ts +48 -0
- package/esm/typings/src/book-2.0/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +22 -0
- package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +19 -0
- package/esm/typings/src/book-2.0/commitments/_misc/AgentModelRequirements.d.ts +37 -0
- package/esm/typings/src/book-2.0/commitments/_misc/AgentSourceParseResult.d.ts +18 -0
- package/esm/typings/src/book-2.0/commitments/_misc/ParsedCommitment.d.ts +22 -0
- package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirements.d.ts +61 -0
- package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirementsWithCommitments.d.ts +35 -0
- package/esm/typings/src/book-2.0/commitments/_misc/createCommitmentRegex.d.ts +20 -0
- package/esm/typings/src/book-2.0/commitments/_misc/parseAgentSourceWithCommitments.d.ts +24 -0
- package/esm/typings/src/book-2.0/commitments/_misc/removeCommentsFromSystemMessage.d.ts +11 -0
- package/esm/typings/src/book-2.0/commitments/index.d.ts +56 -0
- package/esm/typings/src/book-2.0/utils/profileImageUtils.d.ts +39 -0
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +30 -0
- package/esm/typings/src/book-components/_common/react-utils/classNames.d.ts +7 -0
- package/esm/typings/src/config.d.ts +6 -0
- package/esm/typings/src/execution/AvailableModel.d.ts +4 -0
- package/esm/typings/src/execution/ExecutionTask.d.ts +27 -0
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +6 -1
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +0 -5
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/ollama/ollama-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/pipeline/book-notation.d.ts +2 -1
- package/esm/typings/src/types/ModelRequirements.d.ts +0 -2
- package/esm/typings/src/types/typeAliases.d.ts +6 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +46 -6
- package/umd/index.umd.js.map +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { string_url } from '../../../types/typeAliases';
|
|
2
|
+
import type { RAGConfig } from './types';
|
|
3
|
+
import type { RetrievalResult } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* RAG (Retrieval-Augmented Generation) Service
|
|
6
|
+
* Handles knowledge source processing and retrieval
|
|
7
|
+
*
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
export declare class RAGService {
|
|
11
|
+
private knowledgeBase;
|
|
12
|
+
private config;
|
|
13
|
+
constructor(config?: Partial<RAGConfig>);
|
|
14
|
+
/**
|
|
15
|
+
* Add a knowledge source from URL
|
|
16
|
+
*/
|
|
17
|
+
addKnowledgeSource(url: string_url): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Retrieve relevant chunks for a query
|
|
20
|
+
*/
|
|
21
|
+
retrieveRelevantChunks(query: string): RetrievalResult[];
|
|
22
|
+
/**
|
|
23
|
+
* Get formatted context for the agent
|
|
24
|
+
*/
|
|
25
|
+
getContextForQuery(query: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Get knowledge base statistics
|
|
28
|
+
*/
|
|
29
|
+
getStats(): {
|
|
30
|
+
sources: number;
|
|
31
|
+
chunks: number;
|
|
32
|
+
lastUpdated: Date;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Clear all knowledge sources
|
|
36
|
+
*/
|
|
37
|
+
clearKnowledgeBase(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Tokenize query into words for relevance scoring
|
|
40
|
+
*/
|
|
41
|
+
private tokenizeQuery;
|
|
42
|
+
/**
|
|
43
|
+
* Calculate relevance score between content and query words
|
|
44
|
+
* Simple keyword matching - in production, use embeddings
|
|
45
|
+
*/
|
|
46
|
+
private calculateRelevanceScore;
|
|
47
|
+
/**
|
|
48
|
+
* Generate content hash for caching
|
|
49
|
+
*/
|
|
50
|
+
private generateContentHash;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* TODO: !!!! use the already existing RAG instead of this
|
|
54
|
+
*/
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import type { TODO_any } from '../../../../utils/organization/TODO_any';
|
|
4
|
+
import type { string_url } from '../../../../types/typeAliases';
|
|
5
|
+
import type { KnowledgeChunk } from '../types';
|
|
6
|
+
import type { KnowledgeSourceFormat } from '../types';
|
|
7
|
+
import type { RAGConfig } from '../types';
|
|
8
|
+
/**
|
|
9
|
+
* Base class for knowledge source processors
|
|
10
|
+
* Provides common functionality for all knowledge processors
|
|
11
|
+
*
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
14
|
+
export declare abstract class BaseKnowledgeProcessor {
|
|
15
|
+
protected readonly config: RAGConfig;
|
|
16
|
+
constructor(config?: Partial<RAGConfig>);
|
|
17
|
+
/**
|
|
18
|
+
* The format this processor supports
|
|
19
|
+
*/
|
|
20
|
+
abstract readonly supportedFormat: KnowledgeSourceFormat;
|
|
21
|
+
/**
|
|
22
|
+
* Process a buffer and return knowledge chunks
|
|
23
|
+
*/
|
|
24
|
+
abstract processBuffer(buffer: Buffer, sourceUrl: string_url): Promise<KnowledgeChunk[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Generate a content hash for caching purposes
|
|
27
|
+
*/
|
|
28
|
+
protected generateContentHash(content: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Generate a unique chunk ID
|
|
31
|
+
*/
|
|
32
|
+
protected generateChunkId(sourceUrl: string_url, chunkIndex: number): string;
|
|
33
|
+
/**
|
|
34
|
+
* Split text into sentences for better chunking
|
|
35
|
+
*/
|
|
36
|
+
protected splitIntoSentences(text: string): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Get overlap text from the end of current chunk
|
|
39
|
+
*/
|
|
40
|
+
protected getOverlapText(text: string, overlapSize: number): string;
|
|
41
|
+
/**
|
|
42
|
+
* Create chunks from text with proper overlap handling
|
|
43
|
+
*/
|
|
44
|
+
protected createChunksFromText(text: string, sourceUrl: string_url, additionalMetadata?: Record<string, TODO_any>): KnowledgeChunk[];
|
|
45
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import type { string_url } from '../../../../types/typeAliases';
|
|
4
|
+
import type { KnowledgeChunk } from '../types';
|
|
5
|
+
import { BaseKnowledgeProcessor } from './BaseKnowledgeProcessor';
|
|
6
|
+
/**
|
|
7
|
+
* PDF knowledge source processor
|
|
8
|
+
* Handles extraction and chunking of PDF documents
|
|
9
|
+
*
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export declare class PdfProcessor extends BaseKnowledgeProcessor {
|
|
13
|
+
readonly supportedFormat: "pdf";
|
|
14
|
+
/**
|
|
15
|
+
* Process PDF buffer and extract text content
|
|
16
|
+
*/
|
|
17
|
+
processBuffer(buffer: Buffer, sourceUrl: string_url): Promise<KnowledgeChunk[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Extract title from PDF text (first meaningful line)
|
|
20
|
+
*/
|
|
21
|
+
private extractTitleFromText;
|
|
22
|
+
/**
|
|
23
|
+
* Create chunks from PDF text with page awareness
|
|
24
|
+
*/
|
|
25
|
+
protected createChunksFromText(text: string, sourceUrl: string_url, pdfInfo: {
|
|
26
|
+
totalPages: number;
|
|
27
|
+
}): KnowledgeChunk[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* TODO: !!!! Implement this through standard knowledge scraper
|
|
31
|
+
*/
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { string_url } from '../../../../types/typeAliases';
|
|
2
|
+
import type { KnowledgeSourceFormat } from '../types';
|
|
3
|
+
import type { RAGConfig } from '../types';
|
|
4
|
+
import { BaseKnowledgeProcessor } from './BaseKnowledgeProcessor';
|
|
5
|
+
/**
|
|
6
|
+
* Factory for creating knowledge source processors
|
|
7
|
+
*
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
export declare class ProcessorFactory {
|
|
11
|
+
/**
|
|
12
|
+
* Get processor for a specific format
|
|
13
|
+
*/
|
|
14
|
+
static getProcessor(format: KnowledgeSourceFormat, config?: Partial<RAGConfig>): BaseKnowledgeProcessor;
|
|
15
|
+
/**
|
|
16
|
+
* Detect format from URL
|
|
17
|
+
*/
|
|
18
|
+
static detectFormat(url: string_url): KnowledgeSourceFormat;
|
|
19
|
+
/**
|
|
20
|
+
* Get all supported formats
|
|
21
|
+
*/
|
|
22
|
+
static getSupportedFormats(): KnowledgeSourceFormat[];
|
|
23
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import type { string_url } from '../../../../types/typeAliases';
|
|
4
|
+
import type { KnowledgeChunk } from '../types';
|
|
5
|
+
import { BaseKnowledgeProcessor } from './BaseKnowledgeProcessor';
|
|
6
|
+
/**
|
|
7
|
+
* Text knowledge source processor
|
|
8
|
+
* Handles plain text documents
|
|
9
|
+
*
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export declare class TextProcessor extends BaseKnowledgeProcessor {
|
|
13
|
+
readonly supportedFormat: "text";
|
|
14
|
+
/**
|
|
15
|
+
* Process text buffer and extract content
|
|
16
|
+
*/
|
|
17
|
+
processBuffer(buffer: Buffer, sourceUrl: string_url): Promise<KnowledgeChunk[]>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { string_url } from '../../../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Supported knowledge source formats
|
|
4
|
+
*/
|
|
5
|
+
export type KnowledgeSourceFormat = 'pdf' | 'text' | 'markdown' | 'html';
|
|
6
|
+
/**
|
|
7
|
+
* Knowledge source metadata
|
|
8
|
+
*/
|
|
9
|
+
export interface KnowledgeSourceMetadata {
|
|
10
|
+
readonly url: string_url;
|
|
11
|
+
readonly format: KnowledgeSourceFormat;
|
|
12
|
+
readonly title?: string;
|
|
13
|
+
readonly lastFetched?: Date;
|
|
14
|
+
readonly contentHash?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Processed knowledge chunk for RAG
|
|
18
|
+
*/
|
|
19
|
+
export interface KnowledgeChunk {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly sourceUrl: string_url;
|
|
22
|
+
readonly content: string;
|
|
23
|
+
readonly metadata: {
|
|
24
|
+
readonly pageNumber?: number;
|
|
25
|
+
readonly section?: string;
|
|
26
|
+
readonly chunkIndex: number;
|
|
27
|
+
readonly totalChunks: number;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Knowledge base containing all processed knowledge sources
|
|
32
|
+
*/
|
|
33
|
+
export interface KnowledgeBase {
|
|
34
|
+
readonly sources: KnowledgeSourceMetadata[];
|
|
35
|
+
readonly chunks: KnowledgeChunk[];
|
|
36
|
+
readonly lastUpdated: Date;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* RAG retrieval result
|
|
40
|
+
*/
|
|
41
|
+
export interface RetrievalResult {
|
|
42
|
+
readonly chunk: KnowledgeChunk;
|
|
43
|
+
readonly relevanceScore: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Configuration for RAG processing
|
|
47
|
+
*/
|
|
48
|
+
export interface RAGConfig {
|
|
49
|
+
readonly maxChunkSize: number;
|
|
50
|
+
readonly chunkOverlap: number;
|
|
51
|
+
readonly maxRetrievedChunks: number;
|
|
52
|
+
readonly minRelevanceScore: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* [💞] Ignore a discrepancy between file name and entity name
|
|
56
|
+
*/
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../_misc/AgentModelRequirements';
|
|
2
|
+
import { FrontendRAGService } from '../FrontendRAGService';
|
|
3
|
+
/**
|
|
4
|
+
* Helper utilities for RAG processing in chat systems
|
|
5
|
+
*
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
export declare class RAGHelper {
|
|
9
|
+
/**
|
|
10
|
+
* Initialize knowledge sources from agent requirements
|
|
11
|
+
* This should be called when starting a chat session
|
|
12
|
+
*/
|
|
13
|
+
static initializeKnowledgeSources(requirements: AgentModelRequirements): Promise<FrontendRAGService | null>;
|
|
14
|
+
/**
|
|
15
|
+
* Get relevant context for a user query
|
|
16
|
+
* This should be called before sending the query to the AI model
|
|
17
|
+
*/
|
|
18
|
+
static getRelevantContext(ragService: FrontendRAGService | null, userQuery: string): Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Update system message with relevant context for a query
|
|
21
|
+
*/
|
|
22
|
+
static updateSystemMessageWithContext(requirements: AgentModelRequirements, ragService: FrontendRAGService | null, userQuery: string): Promise<AgentModelRequirements>;
|
|
23
|
+
/**
|
|
24
|
+
* Get statistics about the knowledge base
|
|
25
|
+
*/
|
|
26
|
+
static getKnowledgeStats(ragService: FrontendRAGService | null): {
|
|
27
|
+
sources: number;
|
|
28
|
+
chunks: number;
|
|
29
|
+
isInitialized: boolean;
|
|
30
|
+
} | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
34
|
+
*/
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
2
|
+
import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
|
|
3
|
+
/**
|
|
4
|
+
* META IMAGE commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The META IMAGE commitment sets the agent's avatar/profile image URL.
|
|
7
|
+
* This commitment is special because it doesn't affect the system message,
|
|
8
|
+
* but is handled separately in the parsing logic.
|
|
9
|
+
*
|
|
10
|
+
* Example usage in agent source:
|
|
11
|
+
*
|
|
12
|
+
* ```book
|
|
13
|
+
* META IMAGE https://example.com/avatar.jpg
|
|
14
|
+
* META IMAGE /assets/agent-avatar.png
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
18
|
+
*/
|
|
19
|
+
export declare class MetaImageCommitmentDefinition extends BaseCommitmentDefinition<'META IMAGE'> {
|
|
20
|
+
constructor();
|
|
21
|
+
/**
|
|
22
|
+
* Short one-line description of META IMAGE.
|
|
23
|
+
*/
|
|
24
|
+
get description(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Markdown documentation for META IMAGE commitment.
|
|
27
|
+
*/
|
|
28
|
+
get documentation(): string;
|
|
29
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
30
|
+
/**
|
|
31
|
+
* Extracts the profile image URL from the content
|
|
32
|
+
* This is used by the parsing logic
|
|
33
|
+
*/
|
|
34
|
+
extractProfileImageUrl(content: string): string | null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Singleton instance of the META IMAGE commitment definition
|
|
38
|
+
*
|
|
39
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
40
|
+
*/
|
|
41
|
+
export declare const MetaImageCommitment: MetaImageCommitmentDefinition;
|
|
42
|
+
/**
|
|
43
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
44
|
+
*/
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
2
|
+
import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
|
|
3
|
+
/**
|
|
4
|
+
* META LINK commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The `META LINK` commitment represents the link to the person from whom the agent is created.
|
|
7
|
+
* This commitment is special because it doesn't affect the system message,
|
|
8
|
+
* but is handled separately in the parsing logic for profile display.
|
|
9
|
+
*
|
|
10
|
+
* Example usage in agent source:
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* META LINK https://twitter.com/username
|
|
14
|
+
* META LINK https://linkedin.com/in/profile
|
|
15
|
+
* META LINK https://github.com/username
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* Multiple `META LINK` commitments can be used when there are multiple sources:
|
|
19
|
+
*
|
|
20
|
+
* ```book
|
|
21
|
+
* META LINK https://twitter.com/username
|
|
22
|
+
* META LINK https://linkedin.com/in/profile
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
26
|
+
*/
|
|
27
|
+
export declare class MetaLinkCommitmentDefinition extends BaseCommitmentDefinition<'META LINK'> {
|
|
28
|
+
constructor();
|
|
29
|
+
/**
|
|
30
|
+
* Short one-line description of META LINK.
|
|
31
|
+
*/
|
|
32
|
+
get description(): string;
|
|
33
|
+
/**
|
|
34
|
+
* Markdown documentation for META LINK commitment.
|
|
35
|
+
*/
|
|
36
|
+
get documentation(): string;
|
|
37
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
38
|
+
/**
|
|
39
|
+
* Extracts the profile link URL from the content
|
|
40
|
+
* This is used by the parsing logic
|
|
41
|
+
*/
|
|
42
|
+
extractProfileLinkUrl(content: string): string | null;
|
|
43
|
+
/**
|
|
44
|
+
* Validates if the provided content is a valid URL
|
|
45
|
+
*/
|
|
46
|
+
isValidUrl(content: string): boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Singleton instance of the META LINK commitment definition
|
|
50
|
+
*
|
|
51
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
52
|
+
*/
|
|
53
|
+
export declare const MetaLinkCommitment: MetaLinkCommitmentDefinition;
|
|
54
|
+
/**
|
|
55
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
56
|
+
*/
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
2
|
+
import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
|
|
3
|
+
/**
|
|
4
|
+
* MODEL commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The MODEL commitment specifies which AI model to use and can also set
|
|
7
|
+
* model-specific parameters like temperature, topP, and topK.
|
|
8
|
+
*
|
|
9
|
+
* Example usage in agent source:
|
|
10
|
+
*
|
|
11
|
+
* ```book
|
|
12
|
+
* MODEL gpt-4
|
|
13
|
+
* MODEL claude-3-opus temperature=0.3
|
|
14
|
+
* MODEL gpt-3.5-turbo temperature=0.8 topP=0.9
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
18
|
+
*/
|
|
19
|
+
export declare class ModelCommitmentDefinition extends BaseCommitmentDefinition<'MODEL'> {
|
|
20
|
+
constructor();
|
|
21
|
+
/**
|
|
22
|
+
* Short one-line description of MODEL.
|
|
23
|
+
*/
|
|
24
|
+
get description(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Markdown documentation for MODEL commitment.
|
|
27
|
+
*/
|
|
28
|
+
get documentation(): string;
|
|
29
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Singleton instance of the MODEL commitment definition
|
|
33
|
+
*
|
|
34
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
35
|
+
*/
|
|
36
|
+
export declare const ModelCommitment: ModelCommitmentDefinition;
|
|
37
|
+
/**
|
|
38
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
39
|
+
*/
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
2
|
+
import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
|
|
3
|
+
/**
|
|
4
|
+
* NOTE commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The NOTE commitment is used to add comments to the agent source without making any changes
|
|
7
|
+
* to the system message or agent model requirements. It serves as a documentation mechanism
|
|
8
|
+
* for developers to add explanatory comments, reminders, or annotations directly in the agent source.
|
|
9
|
+
*
|
|
10
|
+
* Key features:
|
|
11
|
+
* - Makes no changes to the system message
|
|
12
|
+
* - Makes no changes to agent model requirements
|
|
13
|
+
* - Content is preserved in metadata.NOTE for debugging and inspection
|
|
14
|
+
* - Multiple NOTE commitments are aggregated together
|
|
15
|
+
* - Comments (# NOTE) are removed from the final system message
|
|
16
|
+
*
|
|
17
|
+
* Example usage in agent source:
|
|
18
|
+
*
|
|
19
|
+
* ```book
|
|
20
|
+
* NOTE This agent was designed for customer support scenarios
|
|
21
|
+
* NOTE Remember to update the knowledge base monthly
|
|
22
|
+
* NOTE Performance optimized for quick response times
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* The above notes will be stored in metadata but won't affect the agent's behavior.
|
|
26
|
+
*
|
|
27
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
28
|
+
*/
|
|
29
|
+
export declare class NoteCommitmentDefinition extends BaseCommitmentDefinition<'NOTE'> {
|
|
30
|
+
constructor();
|
|
31
|
+
/**
|
|
32
|
+
* Short one-line description of NOTE.
|
|
33
|
+
*/
|
|
34
|
+
get description(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Markdown documentation for NOTE commitment.
|
|
37
|
+
*/
|
|
38
|
+
get documentation(): string;
|
|
39
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Singleton instance of the NOTE commitment definition
|
|
43
|
+
*
|
|
44
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
45
|
+
*/
|
|
46
|
+
export declare const NoteCommitment: NoteCommitmentDefinition;
|
|
47
|
+
/**
|
|
48
|
+
* [💞] Ignore a discrepancy between file name and entity name
|
|
49
|
+
*/
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
2
|
+
import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
|
|
3
|
+
/**
|
|
4
|
+
* PERSONA commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The PERSONA commitment modifies the agent's personality and character in the system message.
|
|
7
|
+
* It defines who the agent is, their background, expertise, and personality traits.
|
|
8
|
+
*
|
|
9
|
+
* Key features:
|
|
10
|
+
* - Multiple PERSONA commitments are automatically merged into one
|
|
11
|
+
* - Content is placed at the beginning of the system message
|
|
12
|
+
* - Original content with comments is preserved in metadata.PERSONA
|
|
13
|
+
* - Comments (# PERSONA) are removed from the final system message
|
|
14
|
+
*
|
|
15
|
+
* Example usage in agent source:
|
|
16
|
+
*
|
|
17
|
+
* ```book
|
|
18
|
+
* PERSONA You are a helpful programming assistant with expertise in TypeScript and React
|
|
19
|
+
* PERSONA You have deep knowledge of modern web development practices
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* The above will be merged into a single persona section at the beginning of the system message.
|
|
23
|
+
*
|
|
24
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
25
|
+
*/
|
|
26
|
+
export declare class PersonaCommitmentDefinition extends BaseCommitmentDefinition<'PERSONA'> {
|
|
27
|
+
constructor();
|
|
28
|
+
/**
|
|
29
|
+
* Short one-line description of PERSONA.
|
|
30
|
+
*/
|
|
31
|
+
get description(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Markdown documentation for PERSONA commitment.
|
|
34
|
+
*/
|
|
35
|
+
get documentation(): string;
|
|
36
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Singleton instance of the PERSONA commitment definition
|
|
40
|
+
*
|
|
41
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
42
|
+
*/
|
|
43
|
+
export declare const PersonaCommitment: PersonaCommitmentDefinition;
|
|
44
|
+
/**
|
|
45
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
46
|
+
*/
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
2
|
+
import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
|
|
3
|
+
/**
|
|
4
|
+
* RULE commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The RULE/RULES commitment adds behavioral constraints and guidelines that the agent must follow.
|
|
7
|
+
* These are specific instructions about what the agent should or shouldn't do.
|
|
8
|
+
*
|
|
9
|
+
* Example usage in agent source:
|
|
10
|
+
*
|
|
11
|
+
* ```book
|
|
12
|
+
* RULE Always ask for clarification if the user's request is ambiguous
|
|
13
|
+
* RULES Never provide medical advice, always refer to healthcare professionals
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
17
|
+
*/
|
|
18
|
+
export declare class RuleCommitmentDefinition extends BaseCommitmentDefinition<'RULE' | 'RULES'> {
|
|
19
|
+
constructor(type?: 'RULE' | 'RULES');
|
|
20
|
+
/**
|
|
21
|
+
* Short one-line description of RULE/RULES.
|
|
22
|
+
*/
|
|
23
|
+
get description(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Markdown documentation for RULE/RULES commitment.
|
|
26
|
+
*/
|
|
27
|
+
get documentation(): string;
|
|
28
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Singleton instances of the RULE commitment definitions
|
|
32
|
+
*
|
|
33
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
34
|
+
*/
|
|
35
|
+
export declare const RuleCommitment: RuleCommitmentDefinition;
|
|
36
|
+
/**
|
|
37
|
+
* Singleton instances of the RULE commitment definitions
|
|
38
|
+
*
|
|
39
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
40
|
+
*/
|
|
41
|
+
export declare const RulesCommitment: RuleCommitmentDefinition;
|
|
42
|
+
/**
|
|
43
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
44
|
+
*/
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
2
|
+
import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
|
|
3
|
+
/**
|
|
4
|
+
* SAMPLE commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The SAMPLE/EXAMPLE commitment provides examples of how the agent should respond
|
|
7
|
+
* or behave in certain situations. These examples help guide the agent's responses.
|
|
8
|
+
*
|
|
9
|
+
* Example usage in agent source:
|
|
10
|
+
*
|
|
11
|
+
* ```book
|
|
12
|
+
* SAMPLE When asked about pricing, respond: "Our basic plan starts at $10/month..."
|
|
13
|
+
* EXAMPLE For code questions, always include working code snippets
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
17
|
+
*/
|
|
18
|
+
export declare class SampleCommitmentDefinition extends BaseCommitmentDefinition<'SAMPLE' | 'EXAMPLE'> {
|
|
19
|
+
constructor(type?: 'SAMPLE' | 'EXAMPLE');
|
|
20
|
+
/**
|
|
21
|
+
* Short one-line description of SAMPLE/EXAMPLE.
|
|
22
|
+
*/
|
|
23
|
+
get description(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Markdown documentation for SAMPLE/EXAMPLE commitment.
|
|
26
|
+
*/
|
|
27
|
+
get documentation(): string;
|
|
28
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Singleton instances of the SAMPLE commitment definitions
|
|
32
|
+
*
|
|
33
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
34
|
+
*/
|
|
35
|
+
export declare const SampleCommitment: SampleCommitmentDefinition;
|
|
36
|
+
/**
|
|
37
|
+
* Singleton instances of the SAMPLE commitment definitions
|
|
38
|
+
*
|
|
39
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
40
|
+
*/
|
|
41
|
+
export declare const ExampleCommitment: SampleCommitmentDefinition;
|
|
42
|
+
/**
|
|
43
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
44
|
+
*/
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
2
|
+
import type { AgentModelRequirements } from '../_misc/AgentModelRequirements';
|
|
3
|
+
/**
|
|
4
|
+
* STYLE commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The STYLE commitment defines how the agent should format and present its responses.
|
|
7
|
+
* This includes tone, writing style, formatting preferences, and communication patterns.
|
|
8
|
+
*
|
|
9
|
+
* Example usage in agent source:
|
|
10
|
+
*
|
|
11
|
+
* ```book
|
|
12
|
+
* STYLE Write in a professional but friendly tone, use bullet points for lists
|
|
13
|
+
* STYLE Always provide code examples when explaining programming concepts
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
17
|
+
*/
|
|
18
|
+
export declare class StyleCommitmentDefinition extends BaseCommitmentDefinition<'STYLE'> {
|
|
19
|
+
constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Short one-line description of STYLE.
|
|
22
|
+
*/
|
|
23
|
+
get description(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Markdown documentation for STYLE commitment.
|
|
26
|
+
*/
|
|
27
|
+
get documentation(): string;
|
|
28
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Singleton instance of the STYLE commitment definition
|
|
32
|
+
*
|
|
33
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
34
|
+
*/
|
|
35
|
+
export declare const StyleCommitment: StyleCommitmentDefinition;
|
|
36
|
+
/**
|
|
37
|
+
* [💞] Ignore a discrepancy between file name and entity name
|
|
38
|
+
*/
|