-
Notifications
You must be signed in to change notification settings - Fork 105
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
[Go] retrieve and index calls are always actions #291
Conversation
Add ai.DefineRetriever, which creates and registers core.Actions for the index and retrieve methods of a vector DB. Remove RegisterRetriever. Remove the Init functions from our vector DB plugins. Instead, the New functions return a Retriever that supports actions directly. There is no longer a way to create a Retriever that doesn't use actions.
Open questions:
|
My take on your open questions: Open questions:
I personally like the
The metadata is the one that I see as the obvious difference. It's used by the DevUI to provide playgrounds. @pavelgj may know other differences that I'm missing. The JS
I don't think we need to expose actions to the user. If they need them, they can use |
ia := core.NewAction(name, core.ActionTypeIndexer, nil, func(ctx context.Context, req *IndexerRequest) (struct{}, error) { | ||
return struct{}{}, index(ctx, req) | ||
}) | ||
core.RegisterAction(name, ia) |
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.
Suggestion: add core.DefineAction
function that does this -- NewAction
+ RegisterAction
.
Ex:
Line 209 in 5dd2eae
export function defineAction< |
I don't think Dev UI relies too much on retriever metadata today... this sounds fine. Haven't had a chance to play with retrievers in the Dev UI yet.
I'm not opposed to using actions directly, there's no usability problems with that (we actually allow using actions directly in JS as well), the question is more about whether it's important to support referencing retrievers using a string. We know that it's important for models for dotprompt files, but that's not in code. I think it's important to establish a good pattern where the devX allows to define retrievers, models, etc. and then reference them down the call stack. The issue is that it requires that the developer passes the references to these actions throughout the code and I'm not a huge fan of that. Using a string you can define/configure the retriever in one spot/file/package and then just reference it from another without having to deal with obtaining the reference. I'm not sure if there's a clean way to support both in Go... in JS the union types make it easy |
Add ai.DefineRetriever, which creates and registers core.Actions for
the index and retrieve methods of a vector DB.
Remove RegisterRetriever.
Remove the Init functions from our vector DB plugins.
Instead, the New functions return a Retriever that supports
actions directly.
There is no longer a way to create a Retriever that doesn't
use actions.