langchain-ai / langchain

šŸ¦œšŸ”— Build context-aware reasoning applications
https://python.langchain.com
MIT License
93.01k stars 14.94k forks source link

VespaStore not working with latest `pyvespa` #19524

Closed jarib closed 3 months ago

jarib commented 6 months ago

Checked other resources

Example Code

VespaStore.from_documents(...)

Error Message and Stack Trace (if applicable)

 File "<redacted>/embeddings.py", line 92, in run_vespa
    return VespaStore.from_documents(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<redacted>/lib/python3.11/site-packages/langchain_core/vectorstores.py", line 528, in from_documents
    return cls.from_texts(texts, embedding, metadatas=metadatas, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<redacted>/lib/python3.11/site-packages/langchain_community/vectorstores/vespa.py", line 263, in from_texts
    vespa.add_texts(texts=texts, metadatas=metadatas, ids=ids)
  File "<redacted>/lib/python3.11/site-packages/langchain_community/vectorstores/vespa.py", line 114, in add_texts
    results = self._vespa_app.feed_batch(batch)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Vespa' object has no attribute 'feed_batch'

Description

Attempting to use VespaStore with pyvespa ^0.39.0 gives the above error. Apparently the pyvespa API has been changed from feed_batch to feed_iterable.

cc: @lesters @jobergum

System Info


System Information
------------------
> OS:  Darwin
> OS Version:  Darwin Kernel Version 22.6.0: Thu Nov  2 07:43:57 PDT 2023; root:xnu-8796.141.3.701.17~6/RELEASE_ARM64_T6000
> Python Version:  3.11.6 (main, Nov  2 2023, 04:39:43) [Clang 14.0.3 (clang-1403.0.22.14.1)]

Package Information
-------------------
> langchain_core: 0.1.33
> langchain: 0.1.13
> langchain_community: 0.0.29
> langsmith: 0.1.31
> langchain_openai: 0.1.1
> langchain_text_splitters: 0.0.1

Packages not installed (Not Necessarily a Problem)
--------------------------------------------------
The following packages were not found:

> langgraph
> langserve
robert501128 commented 6 months ago

Hey @jarib , I'd like to take this issue, and is estimated to finish it in the next two days. Please let me know if that works. Thanks!

robert501128 commented 6 months ago

Changed from feed_batch and feed_iterable then test, when running this notebook, it seems doing feed_iterable doesn't actually feed the data into Vespa.

Will dig into Vespa a bit tomorrow.

robert501128 commented 6 months ago

Got the result. Will publish it soon.

VidyasagarDudekula commented 6 months ago

@robert501128 please let me know when you push the results. I have been using it for the past 1 month. I have just downgraded the pyvespa to pyvespa==0.38.0. it worked for me but I want to use the latest dev release in pyvespa. Of course, I have seen the issue with feed too. but I am working on a product so, I can't modify the lib, so I just used another version.