English 中文(简体)
查阅文件
原标题:Document search with Azure OpenAI and FAISS is not working

我正试图利用国际助老会协会制定病媒指数,但我要么正在getting:

Attribute错误:str Object has no Depende establish

页: 1

不详 错误:404 -{错误:{代码:404 未找到的资源

from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.vectorstores import FAISS

embeddings = OpenAIEmbeddings(openai_api_key="7b40009xxxxxx2748axxxxxx5553c1a", model= text-embedding-3-small , deployment= Oasis-embedding-3-small , client="azure", chunk_size=10)

#Define the texts you want to add to the FAISS instance
texts = ["FAISS is an important library", "LangChain supports FAISS"]
faiss = FAISS.from_texts(texts, embeddings)

================================================================================================================================================================================================================================================================

Attribute错误:str Object has no Depende establish

审判数名候补人员......但无uck

from langchain.document_loaders.pdf import PyPDFLoaderloader = PyPDFLoader("./data/machine_learning_yearning_by_andrew_ng.pdf")pages= loader.load_and_split()from langchain.embeddings.openai import OpenAIEmbeddings
embedder = OpenAIEmbeddings(api_key= 7b4xxxxxxxxxxxxxxxxx83c915553c1a ,model= text-embedding-3-small ,deployment= Oasis-embedding-3-small ,api_version="2024-02-01",base_url="https://xxxxxxxxxx.openai.azure.com/")
OpenAIEmbeddings(client=<openai.resources.embeddings.Embeddings object at 0x000001E57E40DDD0>, async_client=<openai.resources.embeddings.AsyncEmbeddings object at 0x000001E57E42C210>, model= text-embedding-3-small , deployment= Oxxxx-embedding-3-small , openai_api_version= 2024-02-01 , openai_api_base= https://oxxxxxxxxx.openai.azure.com/ , openai_api_type= Azure , openai_proxy=  , embedding_ctx_length=8191, openai_api_key= 7b4xxxxxxxxxxxxx915553c1a , openai_organization=None, allowed_special=set(), disallowed_special= all , chunk_size=1000, max_retries=2, request_timeout=None, headers=None, tiktoken_enabled=True, tiktoken_model_name=None, show_progress_bar=False, model_kwargs={}, skip_empty=False, default_headers=None, default_query=None, retry_min_seconds=4, retry_max_seconds=20, http_client=None)

错误:

faiss_index = FAISS.from_documents(pages, embedder)

Attribute错误:str Object has no Depende establish

[ FAISS is an important library ,  LangChain supports FAISS ]

不详 错误:404 -{错误:{代码:404 未找到的资源

我正在使用Jupiter Note书......。

我对开放审计协会来说是新鲜事,请帮助我让它从文件(页、插版)或文件——索引 = FAISS.,从文字(页、嵌入)到文字。 什么是失踪? 任何工作样本都载于《开放审计协会文件》。

问题回答

页: 1

最后一个错误信息表明,你正试图使用。 您不妨在文件上核对。

https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.faiss.FAISS.html#langchain_community.vectorstores.faiss.FAISS.from_documents

此处略作改动。

from langchain_openai import OpenAIEmbeddings
from langchain_community.vectorstores import FAISS

embeddings = OpenAIEmbeddings()

#Define the texts you want to add to the FAISS instance
texts = ["FAISS is an important library", "LangChain supports FAISS"]
faiss = FAISS.from_texts(texts, embeddings)

from langchain.document_loaders.pdf import PyPDFLoader

loader = PyPDFLoader("./data/machine_learning_yearning_by_andrew_ng.pdf")
pages= loader.load_and_split()
from langchain.embeddings.openai import OpenAIEmbeddings

faiss_index = FAISS.from_documents(pages, embeddings)
print(faiss_index)




相关问题
How do I connect Alexa to ChatGPT

I m trying to connect Alexa to openAI s API using my APIkey for chat completions and not sure where to write the code for the function in the Alexa Skills Kit. In the Lambda file there are: index.js, ...

CHATGPT Integration [closed]

Can anyone please let me know the steps to integrate ChatGPT in to a website using Api with python I am expecting Chat GPT integration process in to a website for my process. So please let me know the ...

Open AI finish response LENGTH

I am calling open AI api with below details and I am getting below response { value : { outputs : [{ finishReason : LENGTH , text : The summary in this JSON format is as follows: short_ , ...

热门标签