- Импорт, из langchain_community.embeddings импортируем пакет BedrockEmbeddings.
Использование вложений = BedrockEmbeddings(credential_profile_name="default", Region_name="us-east-1", model_id="amazon.titan-embed-text-v2:0" ) для вставлять документы - У меня есть функция, которая встраивает массив документов (называемый пакетом) с помощью embeddings.embed_documents(batch). Это работает.
- Размер моего пакета составляет 250. То есть массив из 250 строк.
- Я время от времени сталкиваюсь с этой ошибкой:
Код: Выделить всё
botocore.errorfactory.ModelTimeoutException: An error occurred (ModelTimeoutException) when calling the InvokeModel operation: Model has timed out in processing the request. Try your request again.Код: Выделить всё
File "...\site-packages\langchain_community\embeddings\bedrock.py", line 150, in _embedding_func raise ValueError(f"Error raised by inference endpoint: {e}") ValueError: Error raised by inference endpoint: An error occurred (ModelTimeoutException) when calling the InvokeModel operation: Model has timed out in processing the request. Try your request again. Подробнее здесь: https://stackoverflow.com/questions/786 ... texception