-
Notifications
You must be signed in to change notification settings - Fork 38
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
[Bug] The expected type comes from property 'pineconeIndex' which is declared here on type 'PineconeStoreParams' #309
Comments
Hey @kirandash , could you share your Without having investigated this issue quite yet, there is a high likelihood this issue stems from Langchain's Pinecone integration, rather than the Pinecone native TS client. |
Hey @aulorbe, Certainly! Here’s how I’m using the fromExistingIndex function and instantiating PineconeStore: // src/app/api/document-query/route.ts
import { pineconeIndex } from "@/lib/pinecone";
import { OpenAI, OpenAIEmbeddings } from "@langchain/openai";
import { PineconeStore } from "@langchain/pinecone";
import { VectorDBQAChain } from "langchain/chains";
import { NextResponse } from "next/server";
export async function POST(req: Request) {
const { prompt } = await req.json();
if (!prompt) {
return NextResponse.json({ error: "Prompt is required" }, { status: 400 });
}
try {
const model = new OpenAI();
if (!model) {
throw new Error("Failed to initialize OpenAI model");
}
const embeddings = new OpenAIEmbeddings({
model: "text-embedding-3-small",
});
const vectorStore = await PineconeStore.fromExistingIndex(embeddings, {
pineconeIndex,
maxConcurrency: 5,
});
const chain = VectorDBQAChain.fromLLM(model, vectorStore, {
k: 1,
returnSourceDocuments: true,
});
const response = await chain.call({
query: prompt,
});
return NextResponse.json({ result: response });
} catch (error) {
console.error(error);
return NextResponse.json({ error: "An error occurred. Please try again" });
}
} And here’s the client setup: // src/lib/pinecone.ts:
import { Pinecone as PineconeClient } from "@pinecone-database/pinecone";
export const pinecone = new PineconeClient();
export const pineconeIndex = pinecone.Index(process.env.PINECONE_INDEX!); You can check out the full implementation here: https://github.com/kirandash/ai-web-apps/blob/main/src/app/api/document-query/route.ts |
Ah okay so |
Yes, that’s correct! |
Ahhh okay, thanks for confirming! It is likely that they just haven't updated their integration since our latest major release ( |
Thanks for looking into this! That makes sense. It’s likely an integration update issue with the latest release. I'll stick with version |
Absolutely, will do! Thanks for bearing with both us and Langchain while we get this sorted :) |
pineconeIndex
type error. The issue does not occur withv3.0.3
Error information
Steps to reproduce the issue locally
My code:
The text was updated successfully, but these errors were encountered: