错误截图:出现在es8版本及以上结合langchain的时候
解决方案:
pip install langchain==0.0.242
错误代码:Traceback (most recent call last):
File "c:\Users\19288\Downloads\新建文件夹\es.py", line 1, in <module>
from langchain.embeddings.openai import OpenAIEmbeddings
File "C:\Users\19288\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\__init__.py", line 6, in <module>
from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
File "C:\Users\19288\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\agents\__init__.py", line 2, in <module>
from langchain.agents.agent import (
File "C:\Users\19288\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\agents\agent.py", line 16, in <module>
from langchain.agents.tools import InvalidTool
s\Python\Python311\Lib\site-packages\langchain\prompts\__init__.py", line 12, in <module>
from langchain.prompts.example_selector import (
File "C:\Users\19288\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\prompts\example_selector\__init__.py", line 4, in <module>
from langchain.prompts.example_selector.semantic_similarity import (
File "C:\Users\19288\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\prompts\example_selector\semantic_similarity.py", line 10, in <module>
from langchain.vectorstores.base import VectorStore
File "C:\Users\19288\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\vectorstores\__init__.py", line 18, in <module>
from langchain.vectorstores.elastic_vector_search import (
File "C:\Users\19288\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\vectorstores\elastic_vector_search.py", line 299
version_num = client.infoversion"]["number"][0]
^
SyntaxError: unterminated string literal (detected at line 299)
ams\Python\Python311\Lib\site-packages\langchain\prompts\example_selector\semantic_similarity.py", line 10, in <module>
from langchain.vectorstores.base import VectorStore
File "C:\Users\19288\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\vectorstores\__init__.py", line 18, in <module>
from langchain.vectorstores.elastic_vector_search import (
File "C:\Users\19288\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\vectorstores\elastic_vector_search.py", line 299
version_num = client.infoversion"]["number"][0]
^
SyntaxError: unterminated string literal (detected at line 299)