https://github.com/hwchase17/langchain/issues/1100
When faiss data and doc.index are created in past versions, error occurs
that say there was no attribute. So I put hasattr in the check as a
simple solution.

However, increasing the number of such checks is not good for
conservatism, so I think there is a better solution.


Also, the code for the batch process was left out, so I put it back in.
searx-api
Hasegawa Yuya 1 year ago committed by GitHub
parent 3f50feb280
commit 383c67c1b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -147,11 +147,13 @@ class OpenAIEmbeddings(BaseModel, Embeddings):
texts, engine=self.document_model_name, chunk_size=chunk_size
)
else:
responses = [
self._embedding_func(text, engine=self.document_model_name)
for text in texts
]
return responses
results = []
for i in range(0, len(texts), chunk_size):
response = self.client.create(
input=texts[i : i + chunk_size], engine=self.document_model_name
)
results += [r["embedding"] for r in response["data"]]
return results
def embed_query(self, text: str) -> List[float]:
"""Call out to OpenAI's embedding endpoint for embedding query text.

Loading…
Cancel
Save