CrewAI PDFSearchTool выдает ошибку при использовании API AZURE OPENAIPython

Программы на Python
Ответить
Anonymous
 CrewAI PDFSearchTool выдает ошибку при использовании API AZURE OPENAI

Сообщение Anonymous »

Почему я получаю следующую ошибку при попытке использовать PDFSearchTool для поиска PDF RAG с помощью CrewAI?
Я использую Azure OpenAPI AI с gpt-4o и text-embedding-ada Модель -002 для перехода в код CrewAI. Я взял ссылку на https://docs.crewai.com/tools/pdfsearch ... searchtool, где говорится, что нужно использовать пользовательскую конфигурацию, если мы используем другую модель, такую ​​как azure_openai.
from multiprocessing import process
from crewai import Agent, Crew, Process, Task,LLM
from crewai_tools import PDFSearchTool
from dotenv import load_dotenv

import litellm
litellm.set_verbose = True

import os

load_dotenv()

os.environ["OPENAI_API_KEY"] = "random key"
os.environ["OPENAI_API_VERSION"] = "2022-01-01"

llm = LLM(
model="azure/gpt-4o",
base_url="https://.openai.azure.com",
api_key="key copied from endpoint section on azure openai"
)

config = dict(
llm=dict(
provider="azure_openai",
config=dict(
model="gpt-4o",
api_key="key copied from endpoint section on azure openai",
deployment_name="https://.openai.azure.com"
),
),
embedder=dict(
provider="azure_openai",
config=dict(
model="text-embedding-ada-002",
deployment_name="https://.openai.azure.com",
api_key="key copied from endpoint section on azure openai"
),
)
)

# --- Tools ---
pdf_search_tool = PDFSearchTool(
config=config,
pdf='./example_home_inspection.pdf'
)

# --- Agents ---
research_agent = Agent(
role="Research Agent",
goal="Search through the PDF to find relevant answers",
allow_delegation=False,
verbose=True,
backstory=(
"""
The research agent is adept at searching and
extracting data from documents, ensuring accurate and prompt responses.
"""
),
tools=[pdf_search_tool],
llm=llm

)

professional_writer_agent = Agent(
role="Professional Writer",
goal="Write professional emails based on the research agent's findings",
allow_delegation=False,
verbose=True,
backstory=(
"""
The professional writer agent has excellent writing skills and is able to craft
clear and concise emails based on the provided information.
"""
),
tools=[]
)

# --- Tasks ---
answer_customer_question_task = Task(
description=(
"""
Answer the customer's questions based on the home inspection PDF.
The research agent will search through the PDF to find the relevant answers.
Your final answer MUST be clear and accurate, based on the content of the home
inspection PDF.

Here is the customer's question:
{customer_question}
"""
),
expected_output="""
Provide clear and accurate answers to the customer's questions based on
the content of the home inspection PDF.
""",
tools=[pdf_search_tool],
agent=research_agent,
llm=llm
)

write_email_task = Task(
description=(
"""
- Write a professional email to a contractor based
on the research agent's findings.
- The email should clearly state the issues found in the specified section
of the report and request a quote or action plan for fixing these issues.
- Ensure the email is signed with the following details:

Best regards,

AuthorName
"""
),
expected_output="""
Write a clear and concise email that can be sent to a contractor to address the
issues found in the home inspection report.
""",
tools=[],
agent=professional_writer_agent,
)

# --- Crew ---
crew = Crew(
agents=[research_agent],
tasks=[answer_customer_question_task],
process=Process.sequential
)
customer_question = input(
"Which section of the report would you like to generate a work order for?\n"
)

result = crew.kickoff(inputs={"customer_question": customer_question})
print(result)

Я использую поэзию для управления пакетами и зависимостями, и вот подробности пакета:
python = ">=3.10.0,=0.4.26"
crewai = ">=0.41.1"
langchain-anthropic = ">=0.1.20"
langchain-openai=">=0.1.7"

Когда я пытаюсь запустить python .py, он выдает:
Agent: Research Agent
Task: Answer the customer's questions based on the home inspection PDF.
The research agent will search through the PDF to find the relevant answers. Your final answer MUST be clear and accurate, based on the content of the home inspection PDF.

Here is the customer's question:Exterior

LiteLLM.Info: If you need to debug this error, use litellm.set_verbose=True'.

2024-12-28 16:04:59,484 - 12164 - llm.py-llm:170 - ERROR: LiteLLM call failed: litellm.APIError: AzureException APIError - Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}} Traceback (most recent call last): File


Подробнее здесь: https://stackoverflow.com/questions/793 ... openai-api
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Python»