Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix: add current datetime to ai filter prompt (#9445)

Marc Klingen8d9c059572a4
diff --git a/web/src/features/natural-language-filters/server/router.ts b/web/src/features/natural-language-filters/server/router.ts
index 83f0b46a5a..ca4265b3bc 100644
--- a/web/src/features/natural-language-filters/server/router.ts
+++ b/web/src/features/natural-language-filters/server/router.ts
@@ -98,7 +98,15 @@ export const naturalLanguageFilterRouter = createTRPCRouter({
{ type: "chat" },
);
- const messages = promptResponse.compile({ userPrompt: input.prompt });
+ // Get current datetime in ISO format with day of week for AI context
+ const now = new Date();
+ const dayOfWeek = now.toLocaleDateString("en-US", { weekday: "long" });
+ const currentDatetime = `${dayOfWeek}, ${now.toISOString()}`;
+
+ const messages = promptResponse.compile({
+ userPrompt: input.prompt,
+ currentDatetime,
+ });
const modelParams = getDefaultModelParams();
const llmCompletion = await fetchLLMCompletion({