-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: agent jump example, enhanced state docs for JS and more #1608
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
base: main
Are you sure you want to change the base?
Conversation
|
Mintlify preview ID generated: preview-cbimpr-1764004660-426cb4a |
| :::js | ||
| **API reference:** @[`openAIModerationMiddleware`] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't hurt to call out that:
- this only works with openai models
- this won't work with model strings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- this only works with openai models
The section starts with Middleware specifically designed for OpenAI models.
2. this won't work with model strings
It does. The middleware model option can be a string too.
|
Mintlify preview ID generated: preview-cbimpr-1764015346-f7fe9be |
| ## Custom state schema | ||
|
|
||
| Middleware can extend the agent's state with custom properties. | ||
| Middleware can extend the agent's state with custom properties. This enables middleware to: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will readers know what agent state is at this point? (is there a cross-link that could be added if not)
|
|
||
| ## Custom context | ||
|
|
||
| Middleware can define a custom context schema to access per-invocation metadata. Unlike state, context is read-only and not persisted between invocations. This makes it ideal for: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In python middleware cannot define custom context yet. it can only access existing context (but can't require that certain keys exist in the context).
If the intention is context extension, then we should only do this for JS (entire section heading should be wrapped in that)
Some further improvements on: