Open
Description
It would be nice to be able to add the Tool itself after using Assistant.create instead of needing to create a class. Personally, I prefer not having to use any classes.
Something like this doesn't currently work:
const assistant = await Assistant.create(assistantData);
subAssistantsData.forEach(async (subAssistantData) => {
const newAssistant = await Assistant.create(subAssistantData);
newAssistant.on('endAsync', async (metadata) => {
console.log(
'endAsync',
subAssistantData.name,
await metadata.stream.finalMessages(),
);
});
return assistant.addAssistantTool(newAssistant);
});
const thread = await Thread.create();
console.log('assistant ask', "Test prompt");
const output = await assistant.ask(
await readFromFile(conversationId, jobId),
thread.id,
);
console.log('output', output);
My current fix :) with an npm patch works, but is not nice.
addAssistantTool2(assistantTool) {
assistantTool.parent = this;
this.experts.push(assistantTool);
if (assistantTool.isParentsTools) {
for (const tool of assistantTool.parentsTools) {
if (tool.type === "function") {
this.tools.push(tool);
this.expertsFunctionNames.push(tool.function.name);
}
}
}
}
Metadata
Metadata
Assignees
Labels
No labels