Skip to content

Conversation

@jba
Copy link
Contributor

@jba jba commented Jun 10, 2024

In this API, configuration (defining actions) should still happen
at the beginning of the program, but can be done incrementally by
calling functions on a plugin. For example:

err := googleai.Init(...)   // creates state common to all actions
m1 := googleai.DefineModel("gemini-1.0-pro")
e1 := googleai.DefineEmbedder("emb-01")

When everything has been configured, the program must call genkit.Init.
This has two effects:

  • Attempts to register additional actions will fail.
  • The dev server is started.

This API combines the convenience and clarity of building and storing
actions individually with the requirement that everything that the
program needs is registered early.

DO NOT SUBMIT. Implementation is incomplete. For discussion only.

@jba jba force-pushed the jba-new-api branch 2 times, most recently from 0d8a148 to 6c9aeab Compare June 11, 2024 14:36
@jba jba requested a review from ianlancetaylor June 11, 2024 14:36
@jba
Copy link
Contributor Author

jba commented Jun 11, 2024

I believe this is complete and correct.

Open questions:

  • For vector DB plugins, it's not clear whether the indexer and retriever should be defined separately, as I've done for pinecone, or together, as I did for localvec. A separate DefineIndexer and DefineRetriever is more in keeping with the rest of the API, but provides an opportunity for different args to be passed, which would give rise to confusing bugs. But if one function is used, users who only want one of the two actions must nevertheless get both. It's also unclear what to name the function. In localvec I called it DefineStore, but that would be an odd name for pinecone, since it doesn't use that term anywhere else.

  • genkit.Init is designed so the default (passing nil) provides a good experience. But its behavior with arguments is complicated. Is there a simpler design?

@ianlancetaylor
Copy link
Contributor

A vector DB plugin is useless if you don't have both an indexer and a retriever, so I would vote for defining them together. Maybe DefineVectorStore or DefineDataStore? I don't think it matters that Pinecone doesn't use those terms.

@jba
Copy link
Contributor Author

jba commented Jun 11, 2024

I imagine that it would be common in larger setups to have one process doing the indexing, in the background as it were, while the frontend retrieves. Much like pkgsite or indeed Google Search.

@ianlancetaylor
Copy link
Contributor

Fair enough.

@jba
Copy link
Contributor Author

jba commented Jun 14, 2024

@pavelgj Can you comment? I believe this is the design we discussed over VC. I want to make sure you're OK with it before proceeding.

jba added 4 commits June 21, 2024 02:39
In this API, configuration (defining actions) should still happen
at the beginning of the program, but can be done incrementally by
calling functions on a plugin. For example:

    err := googleai.Init(...)   // creates state common to all actions
    m1 := googleai.DefineModel("gemini-1.0-pro")
    e1 := googleai.DefineEmbedder("emb-01")

When everything has been configured, the program must call genkit.Init.
This has two effects:
- Attempts to register additional actions will fail.
- Servers are started.

This API combines the convenience and clarity of building and storing
actions individually with the requirement that everything that the
program needs is registered early.
@jba jba merged commit c96702a into main Jun 21, 2024
@jba jba deleted the jba-new-api branch June 21, 2024 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants