Comments (4)
This is mechanically possible now. In these lines from calendar\src\main.ts:
const schema = fs.readFileSync(path.join(__dirname, "calendarActionsSchema.ts"), "utf8");
const translator = createJsonTranslator<CalendarActions>(model, schema, "CalendarActions");
The schema text comes from a file and createJsonTranslator is just taking the schema as a string.
You could build a schema with a static part plus dynamic parts such as adding an enum of available items.
We are looking at adding helper functions around dynamic schema and are open to suggestions.
from typechat.
@steveluc Thank you for your response. Did I understand correctly that I can take a static string schema and dynamically add a generated string describing the type of items in the basket, for example:
type BasketItems = [
{
product: 'tv',
id: '123',
brand: 'noname',
},
{
product: 'laptop',
id: '234',
brand: 'noname',
}
];
So, every time the dynamic data changes, I would need to regenerate the string schema with the updated dynamic part and call createJsonTranslator
again with it?
from typechat.
Yes, that's one way to do it. Load a string template from a file, then apply the template to the dynamic data on update.
from typechat.
I wonder if this is an example of state that ought to be held outside of the typechat context. typechat seems optimal as a natural language interface for generating events that some other system can consume, while leaving the execution and state to those other systems.
For example, from the calendar example, this is the response for "Please add Jennifer to the scrum next Thursday":
{
"actions": [
{
"actionType": "add event",
"event": {
"day": "Friday March 15, 2024",
"timeRange": {
"startTime": "12:00 pm",
"endTime": "2:00 pm"
},
"description": "get my tires changed"
}
}
]
}
It might be that a user has out of office and events should be rejected. One way to do this is load everyone's out of office schedules into the context for the LLM. Another way to consume this event is to make multiple (non-model) API calls in response: pull the user's OOO schedule, check against it, schedule if no conflict.
In your basket example @ValeriyDyachenko, could you store the user's basket state outside of the context and use the agent solely for generating actions? If the user asked for the contents of their cart, that's returnable with a templatized response from an API call. I would guess that this pattern should improve latency and lower LLM costs.
from typechat.
Related Issues (20)
- How to handle multiple languages?
- How to model classical NLU intents and entities(slots)?
- Design Meeting Notes (2023-10-23) HOT 1
- Design Meeting Notes (2023-10-30)
- Design Meeting Notes (2023-11-06)
- Suggestion prompt to return UnknownText HOT 1
- getting started example? HOT 3
- should we read interface as a text file? HOT 2
- error when using translate function
- Streaming HOT 1
- Feat: Add support for Vision API and Input Images
- Add `@dataclass` support to Python
- Ensure Python compatibility back to 3.11 HOT 2
- Implement some snapshot testing for our Python schema translation HOT 1
- Provide helper function parity between TS and Python HOT 1
- Use a chat session as context
- How to log the prompt generated by typechat? HOT 2
- [FEATURE REQUEST] Ollama compatibility
- when will v0.1.0 be released to npm? HOT 5
- docs/examples.md links are broken HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typechat.