microsoft / TypeChat

TypeChat is a library that makes it easy to build natural language interfaces using types.
https://microsoft.github.io/TypeChat/
MIT License
8.06k stars 378 forks source link

How does typechat output time for searching #98

Open mengbo-ji opened 11 months ago

mengbo-ji commented 11 months ago

The model I use is gpt-3.5-turbo. I asked him to return the data of the last seven days. I used it for searching. I expected him to return my current time, but what he gave me seemed to be in 2021. This is my low Problem with version model ?

GPT-Response:

image

image

Schema.ts

image
DanielRosenwasser commented 11 months ago

I haven't tried this, but instead of using number and constructing it with new Date(), I would make it a date string that can be parsed out by Date.parse(). Try adding a comment like

/** A date string of the format YYYY-MM-DDTHH:mm:ss.sssZ */
time: string;

Instead of Z, you can select a specific timezone offset like +08:00.

Stevenic commented 11 months ago

@mengbo-ji you need to tell the model what the current date is as it's stuck in 2021... An easy way to do that is to simply add it to the message text using something like this ${message}\n\ncontext:\ntoday is ${new Date()}. You can append as many context variables as you'd like.