Skip to content

Commit

Permalink
astradb[patch]: Use astrapy's upsert_one method in AstraDBStore (lang…
Browse files Browse the repository at this point in the history
…chain-ai#18063)

As `upsert` is deprecated
  • Loading branch information
cbornet authored and gkorland committed Mar 30, 2024
1 parent 29b8d55 commit 9b195f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/partners/astradb/langchain_astradb/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ async def amget(self, keys: Sequence[str]) -> List[Optional[V]]:
def mset(self, key_value_pairs: Sequence[Tuple[str, V]]) -> None:
self.astra_env.ensure_db_setup()
for k, v in key_value_pairs:
self.collection.upsert({"_id": k, "value": self.encode_value(v)})
self.collection.upsert_one({"_id": k, "value": self.encode_value(v)})

async def amset(self, key_value_pairs: Sequence[Tuple[str, V]]) -> None:
await self.astra_env.aensure_db_setup()
for k, v in key_value_pairs:
await self.async_collection.upsert(
await self.async_collection.upsert_one(
{"_id": k, "value": self.encode_value(v)}
)

Expand Down

0 comments on commit 9b195f6

Please sign in to comment.