Integration with pinecone index API and AWS Lambda

Hello All,

I need to call pinecone API for index query from our AWS Lambda service and is this same approach of passing the Index name and API key from lambda for Index query?

I was also looking for availability of lamdba layer for pinecone-client and do we have this available as part of community dev or we will require to have this at our end?

I am also planning for async mode for pushing embedding by pinecone_index.upsert from our lambda. Is this a good approach or I need to stay in sync mode?

Thanks

Thanks

Hi @Cory_Pinecone Can you please help me on this? Sorry for tagging directly. Thanks

Hi @amitkayal,

No worries. As far as I know, there isn’t a specific lambda-focused version of the Pinecone client. As long as you initiate the connection and instantiate the index object each time the lambda is called, it should work as expected. If you’re instantiating a large number of lambdas at once, you may run into some throttling issues and start to see 5xx errors on your queries, so you’ll want to catch those and use a backoff algorithm to slow things if that happens. All this having been said, this is outside how Pinecone is normally tested, so we can’t make any guarantees. We recommend you do your own extensive testing to make sure everything is copacetic.

Upserting from lambda functions seems fraught with potential issues. What is the source of the vectors? How do you control for each lambda upserting the same vectors over and over? What happens if one lambda fails, will it update the orchestration service so subsequent lambdas know its vectors are still available for upsert?

I recommend you look at our new Spark connector instead. You’ll get far faster upsert speeds without worrying about those issues using lambdas.

If you could share more details around why you’re using lambda functions for all of this we might be able to come up with other options, too.

(Sorry for the edit, hit submit too soon.)

Thanks a lot for your response. Our application is hosted in AWS and hence user input will come from app sync based application which will inturn call Lambda function to generate or update the index. So we need to have serverless way of communication with Pinecone. I also hope that we should be able to append into the existing index. Thanks

Thanks for that additional detail. It sounds like the upserts via lambda will be one offs, and not ingesting a large amount of data, so you should be fine.

Please let us know if you run into any issues in practice. Like I said, this is a bit of a unique use case, and I want to make sure you don’t encounter any unexpected problems.

1 Like

I have a ZenDesk request (4325) open for an issue related here.

I was unable to find documentation on cross region availability.

I am running a lambda in us-east-2, however, this index is in us-east-1 (there is no pinecone availability for indices in us-east-2).

When running with Langchain, logs indicate that the query is initiated then hangs. The Langchain app then times out and passes a timeout response to the front-end via API.

I have tested this locally successfully (no problem connecting to index). I imagine many others are building these server less web apps for LLMS.