-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
types: move types to separate folder
- Loading branch information
Showing
15 changed files
with
175 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* The context input for the agent. | ||
*/ | ||
export interface ContextInput { | ||
input: string | ||
chat_history: string | ||
episodic_memory: string | ||
declarative_memory: string | ||
[key: string]: string | ||
} | ||
|
||
/** | ||
* The intermediate step of the agent. | ||
*/ | ||
export interface IntermediateStep { | ||
tool: string | ||
input: string | null | ||
observation: string | ||
} | ||
|
||
/** | ||
* The agent reply configuration. | ||
*/ | ||
export interface AgentFastReply { | ||
output: string | ||
returnDirect?: boolean | ||
intermediateSteps?: IntermediateStep[] | ||
} | ||
|
||
export type InstantToolTrigger = `${string}{name}${string}` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import type { DocumentInput } from '@langchain/core/documents' | ||
import type { EmbeddedVector, FilterMatch } from './vector-memory.ts' | ||
|
||
/** | ||
* The configuration for memory recall. | ||
*/ | ||
export interface MemoryRecallConfig { | ||
embedding: number[] | ||
k: number | ||
threshold: number | ||
filter?: Record<string, FilterMatch> | ||
} | ||
|
||
/** | ||
* The configurations for each memory recall. | ||
*/ | ||
export interface MemoryRecallConfigs { | ||
episodic: MemoryRecallConfig | ||
declarative: MemoryRecallConfig | ||
procedural: MemoryRecallConfig | ||
[key: string]: MemoryRecallConfig | ||
} | ||
|
||
/** | ||
* A memory document. | ||
*/ | ||
export type MemoryDocument = { | ||
id: string | ||
vector: EmbeddedVector | ||
score: number | ||
} & DocumentInput | ||
|
||
/** | ||
* The working memory of the cat. | ||
*/ | ||
export interface WorkingMemory { | ||
episodic: MemoryDocument[] | ||
declarative: MemoryDocument[] | ||
procedural: MemoryDocument[] | ||
[key: string]: MemoryDocument[] | ||
} | ||
|
||
/** | ||
* The content of a memory message. | ||
*/ | ||
export interface MemoryMessage { | ||
what: string | ||
who: string | ||
when: number | ||
why?: { | ||
input: string | ||
intermediateSteps: Record<string, any>[] | ||
memory?: WorkingMemory | ||
} | ||
} | ||
|
||
/** | ||
* A message object sent by the user. | ||
*/ | ||
export interface Message { | ||
text: string | ||
[key: string]: any | ||
} | ||
|
||
/** | ||
* A message object sent by the websocket. | ||
*/ | ||
export type WSMessage = { | ||
type: 'error' | ||
name: string | ||
description: string | ||
} | { | ||
type: 'token' | 'notification' | ||
content: string | ||
} | ({ | ||
type: 'chat' | ||
} & MemoryMessage) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import type { VectorMemoryCollection } from '@memory/vector-memory-collection.ts' | ||
import type { Schemas } from '@qdrant/js-client-rest' | ||
|
||
export type Filter = Schemas['Filter'] | ||
|
||
export type FilterCondition = Schemas['FieldCondition'] | ||
|
||
export type FilterMatch = FilterCondition['match'] | ||
|
||
export type PointData = Schemas['PointStruct'] | ||
|
||
export type EmbeddedVector = Schemas['NamedVectorStruct'] | ||
|
||
/** | ||
* The configuration of a vector memory. | ||
*/ | ||
export interface VectorMemoryConfig { | ||
embedderName: string | ||
embedderSize: number | ||
} | ||
|
||
/** | ||
* The configurations for each vector memory. | ||
*/ | ||
export interface VectorMemoryCollections { | ||
episodic: VectorMemoryCollection | ||
declarative: VectorMemoryCollection | ||
procedural: VectorMemoryCollection | ||
[key: string]: VectorMemoryCollection | ||
} | ||
|
||
/** | ||
* The accepted JSON format for an imported memory. | ||
*/ | ||
export interface MemoryJson { | ||
embedder: string | ||
collections: { | ||
declarative: PointData[] | ||
procedural: PointData[] | ||
episodic: PointData[] | ||
[key: string]: PointData[] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.