You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The types should complain in the options for the pinecone retriever. I get a runtime error:
Using DevFlowStateStore. Root: /var/folders/y9/0j765brj643gjz3ggwkpn2740000gn/T/.genkit/47a1bd8a68530c0ff153aeb3c40b4c32/flows
Error[/dev-run-action-wrapper/filmRetrieverFlow/filmRetrieverFlow, TypeError] {
path: '/dev-run-action-wrapper/filmRetrieverFlow/filmRetrieverFlow',
name: 'TypeError',
message: "Cannot read properties of undefined (reading 'namespace')",
stack: "TypeError: Cannot read properties of undefined (reading 'namespace')\n" +
' at /Users/jacob/invertase/genkit/genkit-samples/naive-rag/pinecone/node_modules/genkitx-pinecone/lib/index.js:156:37\n' +
' at Generator.next (<anonymous>)\n' +
' at fulfilled (/Users/jacob/invertase/genkit/genkit-samples/naive-rag/pinecone/node_modules/genkitx-pinecone/lib/index.js:47:24)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)',
source: 'ts',
sourceVersion: '0.5.0'
}
To Reproduce
The following code gives no type errors, but it should. The retriever won't work unless you specify k which is the number of results you wish to return.
import{config}from"dotenv";config();import{index,retrieve}from"@genkit-ai/ai/retriever";import{configureGenkit}from"@genkit-ai/core";import{defineFlow}from"@genkit-ai/flow";import{textEmbeddingGecko,vertexAI}from"@genkit-ai/vertexai";import{z}from"zod";import{pineconeRetrieverRef}from"genkitx-pinecone";import{pineconeIndexerRef}from"genkitx-pinecone";import{pinecone}from"genkitx-pinecone";if(!process.env.PINECONE_API_KEY){thrownewError("PINECONE_API_KEY is required");}constfakeData=[{content: [{text: "A film about dodging bullets",},],metadata: {name: "The Matrix",},},{content: [{text: "A film about a space opera",},],metadata: {name: "Star Wars",},},{content: [{text: "A film about a young wizard",},],metadata: {name: "Harry Potter",},},];exportdefaultconfigureGenkit({plugins: [vertexAI(),pinecone([{indexId: "films",embedder: textEmbeddingGecko,clientParams: {apiKey: process.env.PINECONE_API_KEY,},},]),],});exportconstfilmRetriever=pineconeRetrieverRef({indexId: "films",});exportconstfilmIndexer=pineconeIndexerRef({indexId: "films",});exportconstfilmIndexerFlow=defineFlow({name: "filmIndexerFlow",},async()=>{constdocuments=fakeData;awaitindex({indexer: filmIndexer, documents });});exportconstfilmRetrieverFlow=defineFlow({name: "filmRetrieverFlow",inputSchema: z.object({query: z.string()}),// outputSchema: z.array(z.string()),},async({ query, k })=>{constdocs=awaitretrieve({retriever: filmRetriever, query });console.log(docs);// return docs.map((d) => d.metadata!.name!);});
Expected behavior
A type error about not having k in the options of retrieve.
Runtime (please complete the following information):
OS: MacOS
Version [e.g. 0.5.2]
** Node version
run node --version at paste here
20.11.1
Additional context
genkit is on 0.5.2
I had some other issues with retrievers, will open new issues for them at a later point
The text was updated successfully, but these errors were encountered:
Describe the bug
The types should complain in the options for the pinecone retriever. I get a runtime error:
To Reproduce
The following code gives no type errors, but it should. The retriever won't work unless you specify
k
which is the number of results you wish to return.Expected behavior
A type error about not having
k
in the options of retrieve.Runtime (please complete the following information):
** Node version
node --version
at paste hereAdditional context
genkit is on
0.5.2
I had some other issues with retrievers, will open new issues for them at a later point
The text was updated successfully, but these errors were encountered: