Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Attach timestamp tool #313

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions control-plane/src/modules/workflows/agent/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,11 @@ export const findRelevantTools = async (state: WorkflowAgentState) => {
const accessKnowledgeArtifactsTool =
await buildAccessKnowledgeArtifacts(workflow);

const currentDateTimeTool = buildCurrentDateTimeTool();

// When tools are not specified, attach all internalTools
tools.push(accessKnowledgeArtifactsTool);
tools.push(currentDateTimeTool);

events.write({
type: "functionRegistrySearchCompleted",
Expand Down
7 changes: 5 additions & 2 deletions control-plane/src/modules/workflows/agent/tools/date-time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ export const CURRENT_DATE_TIME_TOOL_NAME = "currentDateTime";
export const buildCurrentDateTimeTool = (): AgentTool =>
new AgentTool({
name: CURRENT_DATE_TIME_TOOL_NAME,
description: "Retrieves the current date and time in ISO 8601 format.",
description: "Retrieves the current date and time in ISO 8601 format and unix timestamp.",
schema: z.object({}),
func: async () => {
return new Date().toISOString();
return JSON.stringify({
iso8601: new Date().toISOString(),
unix: new Date().getTime()
})
},
});
Loading