FastChat
FastChat copied to clipboard
langchain test connection time out
当我按照langchain_integration.md配置好前三个服务,都是正常的。使用测试代码,报错,发生异常: ConnectionError HTTPSConnectionPool(host='openaipublic.blob.core.windows.net', port=443): Max retries exceeded with url: /encodings/cl100k_base.tiktoken (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fb7ddcc22b0>: Failed to establish a new connection: [Errno 110] Connection timed out')) TimeoutError: [Errno 110] Connection timed out
During handling of the above exception, another exception occurred:
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fb7ddcc22b0>: Failed to establish a new connection: [Errno 110] Connection timed out
During handling of the above exception, another exception occurred:
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='openaipublic.blob.core.windows.net', port=443): Max retries exceeded with url: /encodings/cl100k_base.tiktoken (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fb7ddcc22b0>: Failed to establish a new connection: [Errno 110] Connection timed out'))
During handling of the above exception, another exception occurred:
File "/workspace/37656/FastChat-main/ceshi.py", line 9, in
测试代码如下:
from langchain.document_loaders import TextLoader from langchain.indexes import VectorstoreIndexCreator from langchain.embeddings import OpenAIEmbeddings from langchain.llms import OpenAI
embedding = OpenAIEmbeddings(model="text-embedding-ada-002",request_timeout=5000)
wget https://raw.githubusercontent.com/hwchase17/langchain/master/docs/modules/state_of_the_union.txt
loader = TextLoader('state_of_the_union.txt') index = VectorstoreIndexCreator(embedding=embedding).from_loaders([loader])
llm = OpenAI(model="gpt-3.5-turbo")
questions = [ "who is the speaker", "What did the president say about Ketanji Brown Jackson", "What are the threats to America", "Who are mentioned in the speech", "Who is the vice president", "How many projects were announced", ]
for query in questions: print("Query: ", query) print("Ans: ",index.query(query,llm=llm))