object has no attribute "embed_documents"
sashokbg opened this issue · comments
Alexander KIRILOV commented
Hello I am trying to run a simple example with langchain and I get:
/home/alexander/projects/cycleup-assistant-venv/bin/python3.12 -X pycache_prefix=/home/alexander/.cache/JetBrains/IntelliJIdea2023.3/cpython-cache /home/alexander/.local/share/JetBrains/IntelliJIdea2023.3/python/helpers/pydev/pydevd.py --multiprocess --qt-support=auto --client 127.0.0.1 --port 37191 --file /home/alexander/projects/cycleup-assistant/flows/embeddings/functions/embeddings.py
Connected to pydev debugger (build 233.14475.28)
Traceback (most recent call last):
File "/home/alexander/.local/share/JetBrains/IntelliJIdea2023.3/python/helpers/pydev/pydevd.py", line 1534, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alexander/.local/share/JetBrains/IntelliJIdea2023.3/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/alexander/projects/cycleup-assistant/flows/embeddings/functions/embeddings.py", line 61, in <module>
embeddings()
File "/home/alexander/projects/cycleup-assistant/flows/embeddings/functions/embeddings.py", line 50, in embeddings
vectorstore = PGVector.from_documents(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alexander/projects/cycleup-assistant-venv/lib/python3.12/site-packages/langchain_postgres/vectorstores.py", line 1119, in from_documents
return cls.from_texts(
^^^^^^^^^^^^^^^
File "/home/alexander/projects/cycleup-assistant-venv/lib/python3.12/site-packages/langchain_postgres/vectorstores.py", line 985, in from_texts
embeddings = embedding.embed_documents(list(texts))
^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'function' object has no attribute 'embed_documents'
python-BaseException
I am using OpenAiEmbeddings
Everything is latest verssion.
Is there some interface change on the OpenAI end that might be the cause of the break ?
Alexander KIRILOV commented
Ah silly me .. I was redefining the method "embeddings" in my python file.
Closing