rig
rig copied to clipboard
feat: extractor hooks
- [x] I have looked for existing issues (including closed) about this
Feature Request
We should have a way to validate that a struct validates all arbitrary requirements without leaving the extractor retry loop.
We should also have a way to add introspection to the extractor (like prompt hooks).
Motivation
Increase DX, observability... etc
Proposal
Something like the below:
trait ExtractorHook: Clone + Send + Sync {
// .. some methods
}
trait ExtractorValidatorHook: Clone + Send + Sync {
fn validate() -> impl Future<Output = Result<String, Error>>;
}
I wonder if it would be a good idea for us to attach the error as a tool result back to the conversation if we are unable to meet the requirements.
I'll be happy to work on this one.