-
Notifications
You must be signed in to change notification settings - Fork 140
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
feat: extractor api improvements #127
Comments
I might have a proposal:
If these ideas make sense I can look into drafting up a PR for the implementation. |
Hey, great ideas! I actually have a partial working implementations of a refactor w/ extractors on my local. I decided to halt on in for a different There's two paths forward:
// Roughly
agent = Client::from_env()
.agent("model-name")
.cast::<MyType>()
.build();
output: MyType = agent.prompt("give me something in MyType")
Both of these are tricky since Atm, All in all, it's a bit of a delicate refactor and I want to work it out further with the team. Atm, the team is taking off for the holidays but I might put together some small PR demos so you can experiment if you like. We've discussed this extensively internally, so it's more inclined we are going to want to design this refactor a bit more in-house, but we'll always welcome external PRs — just no guarantees! Please let me know if you have any questions or thoughts, I'll incorporate it into my mental model for this issue! |
Feature Request
Extractors exist as a wrapper on top of agents with a pre-made tool. Since it constructs and abstracts the agent away, this means you can't customize the agent. This is a problem for anthropic as anthropic requires
max_tokens
to be set atm. This is also quite restrictive in other regards.Extractors are also missing the prompt trait in general making them less composible (as per the
feat/agentic-chains
branch).Extractors only work with full types and not with any
serde_json::Value
which means things likeVec<MyType>
,bool
, etc won't work.Lastly, extractors are built with the use of tools to produce a json output but with the release of json-mode and similar in many providers (like OpenAI, etc), it might be suitable for provider specific or customizable extractors that make use of that feature rather than a custom tool. This customizability isn't really hit within our extractor implementation.
Proposal
Rather than
Extractor
being a whole struct, I wonder if.extract::<Type>(...)
would be a better api. Or some otherExtractor
trait based on the provider that can be written (otherwise using a default tool implementation) to make this a bit more seemless. It seems like a general extractor improvements branch is in order.Alternatives
Keeping the
Extractor
struct but making the agent exposable or even configurable. All the bugs could be fixed in the current implementation.The text was updated successfully, but these errors were encountered: