Skip to content

Commit 409d94d

Browse files
committed
fix: correct IEmbedder stub implementation for TypeScript compatibility
1 parent 60bbf31 commit 409d94d

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/services/conversation-memory/service-factory.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,18 @@ export class ConversationMemoryServiceFactory {
6565

6666
private createEmbedder(): IEmbedder {
6767
// TODO: Create actual embedder based on configuration
68-
// For now, return a stub
68+
// For now, return a stub that properly implements IEmbedder
6969
return {
70-
embed: async (text: string) => {
71-
// Return a dummy embedding vector
72-
return new Array(384).fill(0).map(() => Math.random())
73-
},
74-
embedBatch: async (texts: string[]) => {
75-
return texts.map(() => new Array(384).fill(0).map(() => Math.random()))
76-
},
7770
createEmbeddings: async (texts: string[]) => {
78-
return texts.map(() => new Array(384).fill(0).map(() => Math.random()))
71+
// Return proper EmbeddingResponse format
72+
return {
73+
embeddings: texts.map(() => new Array(384).fill(0).map(() => Math.random())),
74+
model: "stub",
75+
usage: {
76+
prompt_tokens: texts.join("").length,
77+
total_tokens: texts.join("").length,
78+
},
79+
}
7980
},
8081
validateConfiguration: async () => {
8182
return { valid: true }
@@ -85,7 +86,7 @@ export class ConversationMemoryServiceFactory {
8586
dimensions: 384,
8687
maxInputTokens: 8192,
8788
},
88-
} as IEmbedder
89+
} as unknown as IEmbedder
8990
}
9091

9192
private createVectorStore(): IMemoryVectorStore {

0 commit comments

Comments
 (0)