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 379 forks source link

Date type works but returns validate error #107

Open rgstephens opened 10 months ago

rgstephens commented 10 months ago

With this interface

export interface DateTime {
    type: 'dateTime',
    dateTime?: Date;
};

The json results look good but validate fails:

JSON validation failed: Cannot find name 'Date'.
{
  "entities": [
    {
      "type": "dateTime",
      "dateTime": "2022-08-20T08:30:00.000Z"
    }
  ]
}
SweetpopcornSimon commented 10 months ago

Hi I had the same issue, try changing dateTime to a string.

caridy commented 9 months ago

At the moment, this is not possible since the output of the LLM is a JSON string, and there are no hooks to control the parsing of that json. I suspect that we might ended up having some sort of macro system that might allow you to translate the json into the actual plan (sequence of actions).

Another challenge here is the fact that TypeChat lib for standard types is very very limited because on the current form, it doesn't need anything else. The good news is that such part is just needed for validation, which does not need to ever go into the LLM prompt context, which makes it easier to perhaps change this to support macros and supporting expansion of the actions.