mirror of
https://github.com/agno-agi/agno.git
synced 2026-10-11 22:09:58 +00:00
## Description - **Summary of changes**: async support for youtube reader and kb - **Related issues**: Mention if this PR fixes or is connected to any issues. - **Motivation and context**: Explain the reason for the changes and the problem they solve. - **Environment or dependencies**: Specify any changes in dependencies or environment configurations required for this update. - **Impact on metrics**: (If applicable) Describe changes in any metrics or performance benchmarks. Fixes # (issue) --- ## Type of change Please check the options that are relevant: - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Model update (Addition or modification of models) - [ ] Other (please describe): --- ## Checklist - [ ] Adherence to standards: Code complies with Agno’s style guidelines and best practices. - [ ] Formatting and validation: You have run `./scripts/format.sh` and `./scripts/validate.sh` to ensure code is formatted and linted. - [ ] Self-review completed: A thorough review has been performed by the contributor(s). - [ ] Documentation: Docstrings and comments have been added or updated for any complex logic. - [ ] Examples and guides: Relevant cookbook examples have been included or updated (if applicable). - [ ] Tested in a clean environment: Changes have been tested in a clean environment to confirm expected behavior. - [ ] Tests (optional): Tests have been added or updated to cover any new or changed functionality. --- ## Additional Notes Include any deployment notes, performance implications, security considerations, or other relevant information (e.g., screenshots or logs if applicable). --------- Co-authored-by: Dirk Brand <[email protected]>
27 lines
729 B
Python
27 lines
729 B
Python
from os import getenv
|
|
|
|
from agno.agent import Agent
|
|
from agno.knowledge.youtube import YouTubeKnowledgeBase, YouTubeReader
|
|
from agno.vectordb.qdrant import Qdrant
|
|
|
|
api_key = getenv("QDRANT_API_KEY")
|
|
qdrant_url = getenv("QDRANT_URL")
|
|
|
|
vector_db = Qdrant(collection="youtube-agno", url=qdrant_url, api_key=api_key)
|
|
|
|
knowledge_base = YouTubeKnowledgeBase(
|
|
urls=["https://www.youtube.com/watch?v=CDC3GOuJyZ0"],
|
|
vector_db=vector_db,
|
|
reader=YouTubeReader(chunk=True),
|
|
)
|
|
knowledge_base.load(recreate=False) # only once, comment it out after first run
|
|
|
|
agent = Agent(
|
|
knowledge=knowledge_base,
|
|
search_knowledge=True,
|
|
)
|
|
|
|
agent.print_response(
|
|
"What is the major focus of the knowledge provided?", markdown=True
|
|
)
|