Skip to content

Commit

Permalink
fix: getEmbeddingZeroVector calls
Browse files Browse the repository at this point in the history
  • Loading branch information
cygaar committed Nov 29, 2024
1 parent 72d4cd1 commit 2a03469
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions packages/client-discord/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export class DiscordClient extends EventEmitter {
},
roomId,
createdAt: timestamp,
embedding: getEmbeddingZeroVector(this.runtime),
embedding: getEmbeddingZeroVector(),
};

try {
Expand Down Expand Up @@ -348,7 +348,7 @@ export class DiscordClient extends EventEmitter {
},
roomId,
createdAt: Date.now(),
embedding: getEmbeddingZeroVector(this.runtime),
embedding: getEmbeddingZeroVector(),
});
} catch (error) {
console.error("Error creating reaction removal message:", error);
Expand Down Expand Up @@ -391,4 +391,4 @@ export const DiscordClientInterface: ElizaClient = {
stop: async (_runtime: IAgentRuntime) => {
console.warn("Discord client does not support stopping yet");
},
};
};
2 changes: 1 addition & 1 deletion packages/client-discord/src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export class MessageManager {
url: m.url,
},
roomId,
embedding: getEmbeddingZeroVector(this.runtime),
embedding: getEmbeddingZeroVector(),
createdAt: m.createdTimestamp,
};
memories.push(memory);
Expand Down
4 changes: 2 additions & 2 deletions packages/client-discord/src/voice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ export class VoiceManager extends EventEmitter {
},
userId: userIdUUID,
roomId,
embedding: getEmbeddingZeroVector(this.runtime),
embedding: getEmbeddingZeroVector(),
createdAt: Date.now(),
};

Expand Down Expand Up @@ -670,7 +670,7 @@ export class VoiceManager extends EventEmitter {
inReplyTo: memory.id,
},
roomId,
embedding: getEmbeddingZeroVector(this.runtime),
embedding: getEmbeddingZeroVector(),
};

if (responseMemory.content.text?.trim()) {
Expand Down
2 changes: 1 addition & 1 deletion packages/client-farcaster/src/memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function createCastMemory({
hash: cast.id,
},
roomId,
embedding: getEmbeddingZeroVector(runtime),
embedding: getEmbeddingZeroVector(),
createdAt: cast.message.data.timestamp * 1000,
};
}
Expand Down
4 changes: 2 additions & 2 deletions packages/client-telegram/src/messageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ export class MessageManager {
roomId,
content,
createdAt: message.date * 1000,
embedding: getEmbeddingZeroVector(this.runtime),
embedding: getEmbeddingZeroVector(),
};

// Create memory
Expand Down Expand Up @@ -468,7 +468,7 @@ export class MessageManager {
inReplyTo: messageId,
},
createdAt: sentMessage.date * 1000,
embedding: getEmbeddingZeroVector(this.runtime),
embedding: getEmbeddingZeroVector(),
};

// Set action to CONTINUE for all messages except the last one
Expand Down
6 changes: 3 additions & 3 deletions packages/client-twitter/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ export class ClientBase extends EventEmitter {
content: content,
agentId: this.runtime.agentId,
roomId,
embedding: getEmbeddingZeroVector(this.runtime),
embedding: getEmbeddingZeroVector(),
createdAt: tweet.timestamp * 1000,
});

Expand Down Expand Up @@ -533,7 +533,7 @@ export class ClientBase extends EventEmitter {
content: content,
agentId: this.runtime.agentId,
roomId,
embedding: getEmbeddingZeroVector(this.runtime),
embedding: getEmbeddingZeroVector(),
createdAt: tweet.timestamp * 1000,
});

Expand Down Expand Up @@ -575,7 +575,7 @@ export class ClientBase extends EventEmitter {
} else {
await this.runtime.messageManager.createMemory({
...message,
embedding: getEmbeddingZeroVector(this.runtime),
embedding: getEmbeddingZeroVector(),
});
}

Expand Down
2 changes: 1 addition & 1 deletion packages/client-twitter/src/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ export class TwitterInteractionClient {
currentTweet.userId === this.twitterUserId
? this.runtime.agentId
: stringToUuid(currentTweet.userId),
embedding: getEmbeddingZeroVector(this.runtime),
embedding: getEmbeddingZeroVector(),
});
}

Expand Down
2 changes: 1 addition & 1 deletion packages/client-twitter/src/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export class TwitterPostClient {
source: "twitter",
},
roomId,
embedding: getEmbeddingZeroVector(this.runtime),
embedding: getEmbeddingZeroVector(),
createdAt: tweet.timestamp * 1000,
});
} catch (error) {
Expand Down
4 changes: 2 additions & 2 deletions packages/client-twitter/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export async function buildConversationThread(
currentTweet.userId === client.profile.id
? client.runtime.agentId
: stringToUuid(currentTweet.userId),
embedding: getEmbeddingZeroVector(client.runtime),
embedding: getEmbeddingZeroVector(),
});
}

Expand Down Expand Up @@ -229,7 +229,7 @@ export async function sendTweet(
: undefined,
},
roomId,
embedding: getEmbeddingZeroVector(client.runtime),
embedding: getEmbeddingZeroVector(),
createdAt: tweet.timestamp * 1000,
}));

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/knowledge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async function set(
userId: runtime.agentId,
createdAt: Date.now(),
content: item.content,
embedding: getEmbeddingZeroVector(runtime),
embedding: getEmbeddingZeroVector(),
});

const preprocessed = preprocess(item.content.text);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class MemoryManager implements IMemoryManager {
} catch (error) {
elizaLogger.error("Failed to generate embedding:", error);
// Fallback to zero vector if embedding fails
memory.embedding = getEmbeddingZeroVector(this.runtime).slice();
memory.embedding = getEmbeddingZeroVector().slice();
}

return memory;
Expand Down

0 comments on commit 2a03469

Please sign in to comment.