У меня есть urllib.error.httperror: http error 400: плохой запрос при использовании Youtubevideosearchtool в Crewai для Python

Программы на Python
Ответить Пред. темаСлед. тема
Anonymous
 У меня есть urllib.error.httperror: http error 400: плохой запрос при использовании Youtubevideosearchtool в Crewai для

Сообщение Anonymous »

У меня есть urllib.error.httperror: http error 400: ошибка плохого запроса при использовании инструмента YoutubeVideoSearchTool в моей команде, построенном с Crewai для Python. Я следил за документацией, и это мой код для моего файла exat.py :

Код: Выделить всё

import re
from crewai import Agent, Crew, Process, Task
from crewai.project import CrewBase, agent, crew, task
from crewai_tools import SerperDevTool, YoutubeVideoSearchTool

from .tools.docx_read_tool import DocxReadTool

# If you want to run a snippet of code before or after the crew starts,
# you can use the @before_kickoff and @after_kickoff decorators
# https://docs.crewai.com/concepts/crews#example-crew-class-with-decorators

@CrewBase
class YouTubeScript():
"""YouTubeScript crew"""

# Learn more about YAML configuration files here:
# Agents: https://docs.crewai.com/concepts/agents#yaml-configuration-recommended
# Tasks: https://docs.crewai.com/concepts/tasks#yaml-configuration-recommended
agents_config = 'config/agents.yaml'
tasks_config = 'config/tasks.yaml'
# If you would like to add tools to your agents, you can learn more about it here:
# https://docs.crewai.com/concepts/agents#agent-tools
@agent
def researcher(self) -> Agent:
return Agent(
config=self.agents_config['researcher'],
verbose=True,
tools=[SerperDevTool()]
)

@agent
def youtube_video_researcher(self) -> Agent:
youtube_search_tool = YoutubeVideoSearchTool(
youtube_video_url='https://youtube.com/watch?v=E4l91XKQSgw'
)
return Agent(
config=self.agents_config['youtube_video_researcher'],
verbose=True,
tools=[youtube_search_tool]
)

@agent
def screenwriter(self) -> Agent:
return Agent(
config=self.agents_config['screenwriter'],
verbose=True,
tools=[DocxReadTool(directory="/Users/danielerazo/Documents/yt-scripts")]
)

# To learn more about structured task outputs,
# task dependencies, and task callbacks, check out the documentation:
# https://docs.crewai.com/concepts/tasks#overview-of-a-task
@task
def research_task(self) -> Task:
return Task(
config=self.tasks_config['research_task'],
output_key="research_output"
)

@task
def youtube_research_task(self) -> Task:
def extract_youtube_link(context):
research_output = context["research_output"]
match = re.search(r"(https?://(?:www\.)?youtube\.com/\S+)", research_output)
if match:
return { "youtube_video_url": match.group(1) }
else:
raise ValueError("No YouTube URL found in research output!")
return Task(
config=self.tasks_config['youtube_research_task'],
)

@task
def screenwriting_task(self) -> Task:
return Task(
config=self.tasks_config['screenwriting_task'],
output_file='output/script.md'
)

@crew
def crew(self) -> Crew:
"""Creates the LatestTechAnalysis crew"""
# To learn how to add knowledge sources to your crew, check out the documentation:
# https://docs.crewai.com/concepts/knowledge#what-is-knowledge

return Crew(
agents=self.agents, # Automatically created by the @agent decorator
tasks=self.tasks, # Automatically created by the @task decorator
process=Process.sequential,
verbose=True,
# process=Process.hierarchical, # In case you wanna use that instead https://docs.crewai.com/how-to/Hierarchical/
)
Моя цель состоит в том, чтобы построить систему агента сценаризма на YouTube, в которой агент исследователя находит URL -адрес видео YT из своего исследования и передает URL -адрес для агента видео -исследователя на YouTube, я пытаюсь проверить youtubevideosearchtool в первую очередь со статическим URL, но здесь есть ошибка. /> return urlopen(request, timeout=timeout)
< /code>
Не уверен, почему дает ошибку 400, если URL кажется правильным, я не нашел аналогичную ошибку на другом сайте. Для контекста я использую Python 3.11.11 и последнюю версию Crewai.>

Подробнее здесь: https://stackoverflow.com/questions/795 ... -using-the
Реклама
Ответить Пред. темаСлед. тема

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

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

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

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

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Urllib.error.HTTPError: Ошибка HTTP 403: запрещено с помощью urllib.requests
    Anonymous » » в форуме Python
    0 Ответы
    20 Просмотры
    Последнее сообщение Anonymous
  • Pytube постоянно терпит неудачу с HTTP Error 400: Плохой запрос также в последней версии
    Anonymous » » в форуме Python
    0 Ответы
    1 Просмотры
    Последнее сообщение Anonymous
  • Pytube постоянно терпит неудачу с HTTP Error 400: Плохой запрос также в последней версии
    Anonymous » » в форуме Python
    0 Ответы
    3 Просмотры
    Последнее сообщение Anonymous
  • Pytube постоянно терпит неудачу с HTTP Error 400: Плохой запрос также в последней версии
    Anonymous » » в форуме Python
    0 Ответы
    3 Просмотры
    Последнее сообщение Anonymous
  • HTTPError: Ошибка HTTP 400: неверный запрос (в Python) [закрыто]
    Anonymous » » в форуме Python
    0 Ответы
    31 Просмотры
    Последнее сообщение Anonymous

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