Skip to content

Commit

Permalink
Merge pull request #216 from autonomys/feat/saeid-self-sch
Browse files Browse the repository at this point in the history
Fix closed vector db bug
  • Loading branch information
jfrank-summit authored Feb 6, 2025
2 parents a11316a + fcd93f6 commit 716e39d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export const createFinishWorkflowPrompt = async (customInstructions?: string) =>
- The response should start and end with curly braces`;

const workflowSummarySystemPrompt = await PromptTemplate.fromTemplate(
`Summarize the following messages in detail. This is being returned as a report to what was accomplished during the execution of the workflow. Additionally, provide a recommendation for the next action to take when the workflow begins again and how long until the next workflow should begin.
`
Summarize the following messages in detail. This is being returned as a report to what was accomplished during the execution of the workflow.
Additionally,provide a recommendation for the next action to take when the workflow begins again and how long until the next workflow should begin.
You have a personality, so you should act accordingly.
{characterDescription}
Expand Down
5 changes: 5 additions & 0 deletions src/agents/workflows/orchestrator/orchestratorWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ export const createOrchestratorRunner = async (
const threadId = options?.threadId || 'orchestrator_workflow_state';
logger.info('Starting orchestrator workflow', { threadId });

if (!vectorStore.isOpen()) {
logger.info('Opening vector store connection for new workflow run');
await vectorStore.open();
}

const config = {
recursionLimit: 50,
configurable: {
Expand Down
12 changes: 12 additions & 0 deletions src/services/vectorDb/VectorDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,18 @@ export class VectorDB {
return this.db;
}

public isOpen(): boolean {
return this.db && !this.db.open === false;
}

public async open(): Promise<void> {
if (!this.isOpen()) {
logger.info('Opening VectorDB connection');
this.initializeDatabase();
logger.info('VectorDB opened successfully');
}
}

public close(): void {
logger.info('Closing VectorDB connection');
if (this.db) {
Expand Down

0 comments on commit 716e39d

Please sign in to comment.