Skip to content
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

Use official pinecone npm package #112

Merged
merged 9 commits into from
Feb 26, 2023

Conversation

fraserxu
Copy link
Contributor

@fraserxu fraserxu commented Feb 23, 2023

#104

I was able to replace the pinecone client with official one easily without much change. Tested to index and search both works fine.

index

const pinecone = new PineconeClient()
await pinecone.init({
  environment: "us-west1-gcp",
  apiKey: process.env.PINECONE_API_KEY,
})
const index = pinecone.Index("my-index")
await PineconeStore.fromDocuments(
  index,
  docs,
  new OpenAIEmbeddings({
    openAIApiKey: process.env.OPEN_API_KEY,
  })
)

query

const pinecone = new PineconeClient()

await pinecone.init({
  environment: "us-west1-gcp",
  apiKey: process.env.PINECONE_API_KEY,
})

const index = pinecone.Index("my-index")
const vectorStore = await PineconeStore.fromExistingIndex(
  index,
  new OpenAIEmbeddings({
    openAIApiKey: process.env.OPEN_API_KEY,
  })
)

const model = new OpenAI({
  openAIApiKey: process.env.OPEN_API_KEY,
})
const chain = VectorDBQAChain.fromLLM(model, vectorStore)
const response = await chain.call({
  query: "what does the doc say about pinecone",
})

TODO:

  • update doc
  • fix type error

@rschwabco
Copy link

@fraserxu We have a PR out moving the Pinecone client from Axios to fetch, should be merged shortly. Small breaking changes, like not using data in the response.

@rschwabco
Copy link

@fraserxu We have a PR out moving the Pinecone client from Axios to fetch, should be merged shortly. Small breaking changes, like not using data in the response.

PR was merge, v0.0.7 is now available.

@fraserxu
Copy link
Contributor Author

Thanks @rschwabco 🎉 I'll get the new version in and update my pr accordingly. 🙇

@fraserxu
Copy link
Contributor Author

PR was merge, v0.0.7 is now available.

I see 0.0.8 is available and just synced up with it.

@fraserxu
Copy link
Contributor Author

Have fixed the build too.

@fraserxu fraserxu requested a review from dqbd February 25, 2023 22:51
@fraserxu
Copy link
Contributor Author

Can you please take a look at this pull request and let me know what you think @hwchase17 ? Thanks!

Copy link
Collaborator

@hwchase17 hwchase17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! dont mind the breaking changes that much given the earliness of the package

@hwchase17 hwchase17 changed the base branch from main to harrison/pinecone February 26, 2023 16:36
@hwchase17 hwchase17 merged commit 186abe3 into langchain-ai:harrison/pinecone Feb 26, 2023
hwchase17 added a commit that referenced this pull request Feb 26, 2023
* Use official pinecone npm package (#112)

* use official pinecone npm package

* update doc

* fix types for addVectors

* sync up with 0.0.8

* UpsertResponse is not used

* fix formatting for docs and examples

* cr

---------

Co-authored-by: Fraser Xu <xvfeng123@gmail.com>
jacoblee93 pushed a commit that referenced this pull request Oct 9, 2024
… type safe (#127)

* Pregel/Graph: Make channel creation explicit, make Pregel constructor type safe

- still need to migrate StateGraph

* Make type args const

* Add stricter typings for graph/stategraph/messagegraph constructors (#128)

* Add stricter typings for graph/stategraph/messagegraph constructors

Inspired by #112

* Fix tests

* Fix remaining types
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.

6 participants