agno 2.0.4__py3-none-any.whl → 2.0.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. agno/agent/agent.py +74 -85
  2. agno/db/dynamo/dynamo.py +2 -2
  3. agno/db/firestore/firestore.py +3 -2
  4. agno/db/gcs_json/gcs_json_db.py +2 -2
  5. agno/db/json/json_db.py +2 -2
  6. agno/db/migrations/v1_to_v2.py +191 -23
  7. agno/db/mongo/mongo.py +61 -2
  8. agno/db/mysql/mysql.py +5 -5
  9. agno/db/mysql/schemas.py +27 -27
  10. agno/db/postgres/postgres.py +5 -5
  11. agno/db/redis/redis.py +2 -2
  12. agno/db/singlestore/singlestore.py +2 -2
  13. agno/db/sqlite/sqlite.py +6 -5
  14. agno/db/utils.py +0 -14
  15. agno/integrations/discord/client.py +1 -0
  16. agno/knowledge/knowledge.py +7 -7
  17. agno/knowledge/reader/reader_factory.py +7 -3
  18. agno/knowledge/reader/web_search_reader.py +12 -6
  19. agno/models/message.py +109 -0
  20. agno/models/openai/responses.py +6 -0
  21. agno/os/app.py +162 -42
  22. agno/os/interfaces/agui/utils.py +98 -134
  23. agno/os/routers/health.py +0 -1
  24. agno/os/routers/home.py +52 -0
  25. agno/os/routers/knowledge/knowledge.py +2 -2
  26. agno/os/schema.py +21 -0
  27. agno/os/utils.py +0 -8
  28. agno/run/agent.py +3 -3
  29. agno/run/team.py +3 -3
  30. agno/team/team.py +33 -38
  31. agno/tools/duckduckgo.py +15 -11
  32. agno/tools/googlesearch.py +1 -1
  33. agno/utils/string.py +32 -0
  34. agno/utils/tools.py +1 -1
  35. agno/workflow/step.py +4 -3
  36. {agno-2.0.4.dist-info → agno-2.0.5.dist-info}/METADATA +6 -5
  37. {agno-2.0.4.dist-info → agno-2.0.5.dist-info}/RECORD +40 -40
  38. agno/knowledge/reader/url_reader.py +0 -128
  39. {agno-2.0.4.dist-info → agno-2.0.5.dist-info}/WHEEL +0 -0
  40. {agno-2.0.4.dist-info → agno-2.0.5.dist-info}/licenses/LICENSE +0 -0
  41. {agno-2.0.4.dist-info → agno-2.0.5.dist-info}/top_level.txt +0 -0
@@ -1,128 +0,0 @@
1
- from io import BytesIO
2
- from os.path import basename
3
- from pathlib import Path
4
- from typing import List, Optional
5
- from urllib.parse import urlparse
6
-
7
- import httpx
8
-
9
- from agno.knowledge.chunking.fixed import FixedSizeChunking
10
- from agno.knowledge.chunking.strategy import ChunkingStrategy, ChunkingStrategyType
11
- from agno.knowledge.document.base import Document
12
- from agno.knowledge.reader.base import Reader
13
- from agno.knowledge.reader.csv_reader import CSVReader
14
- from agno.knowledge.reader.pdf_reader import PDFReader
15
- from agno.knowledge.types import ContentType
16
- from agno.utils.http import async_fetch_with_retry, fetch_with_retry
17
- from agno.utils.log import log_debug
18
-
19
-
20
- class URLReader(Reader):
21
- """Reader for general URL content"""
22
-
23
- def __init__(
24
- self, chunking_strategy: Optional[ChunkingStrategy] = FixedSizeChunking(), proxy: Optional[str] = None, **kwargs
25
- ):
26
- super().__init__(chunking_strategy=chunking_strategy, **kwargs)
27
- self.proxy = proxy
28
-
29
- @classmethod
30
- def get_supported_chunking_strategies(self) -> List[ChunkingStrategyType]:
31
- """Get the list of supported chunking strategies for URL readers."""
32
- return [
33
- ChunkingStrategyType.FIXED_SIZE_CHUNKER,
34
- ChunkingStrategyType.AGENTIC_CHUNKER,
35
- ChunkingStrategyType.DOCUMENT_CHUNKER,
36
- ChunkingStrategyType.RECURSIVE_CHUNKER,
37
- ChunkingStrategyType.SEMANTIC_CHUNKER,
38
- ]
39
-
40
- @classmethod
41
- def get_supported_content_types(self) -> List[ContentType]:
42
- return [ContentType.URL]
43
-
44
- def read(
45
- self, url: str, id: Optional[str] = None, name: Optional[str] = None, password: Optional[str] = None
46
- ) -> List[Document]:
47
- if not url:
48
- raise ValueError("No url provided")
49
-
50
- log_debug(f"Reading: {url}")
51
-
52
- # Retry the request up to 3 times with exponential backoff
53
- response = fetch_with_retry(url, proxy=self.proxy)
54
-
55
- documents = self._create_documents(
56
- url=url, text=response.text, content=response.content, id=id, name=name, password=password
57
- )
58
-
59
- if not self.chunk:
60
- return documents
61
-
62
- chunked_documents = []
63
- for document in documents:
64
- chunked_documents.append(self.chunk_document(document))
65
- return [doc for sublist in chunked_documents for doc in sublist]
66
-
67
- async def async_read(
68
- self, url: str, id: Optional[str] = None, name: Optional[str] = None, password: Optional[str] = None
69
- ) -> List[Document]:
70
- """Async version of read method"""
71
- if not url:
72
- raise ValueError("No url provided")
73
-
74
- log_debug(f"Reading async: {url}")
75
- client_args = {"proxy": self.proxy} if self.proxy else {}
76
- async with httpx.AsyncClient(**client_args) as client: # type: ignore
77
- response = await async_fetch_with_retry(url, client=client)
78
-
79
- documents = self._create_documents(
80
- url=url, text=response.text, content=response.content, id=id, name=name, password=password
81
- )
82
-
83
- if not self.chunk:
84
- return documents
85
-
86
- return await self.chunk_documents_async(documents)
87
-
88
- def _create_documents(
89
- self,
90
- url: str,
91
- text: str,
92
- content: bytes,
93
- id: Optional[str] = None,
94
- name: Optional[str] = None,
95
- password: Optional[str] = None,
96
- ) -> List[Document]:
97
- """Helper method to create a document from URL content"""
98
-
99
- # Determine file extension from URL
100
- parsed_url = urlparse(url)
101
- url_path = Path(parsed_url.path) # type: ignore
102
- file_extension = url_path.suffix.lower()
103
-
104
- # Read the document using the appropriate reader
105
- if file_extension == ".csv":
106
- filename = basename(parsed_url.path) or "data.csv"
107
- return CSVReader().read(file=BytesIO(content), name=filename)
108
- elif file_extension == ".pdf":
109
- if password:
110
- return PDFReader().read(pdf=BytesIO(content), name=name, password=password)
111
- else:
112
- return PDFReader().read(pdf=BytesIO(content), name=name)
113
- else:
114
- doc_name = name or parsed_url.path.strip("/").replace("/", "_").replace(" ", "_")
115
- if not doc_name:
116
- doc_name = parsed_url.netloc
117
- if not doc_name:
118
- doc_name = url
119
-
120
- return [
121
- Document(
122
- name=doc_name,
123
- id=id or doc_name,
124
- meta_data={"url": url},
125
- content=text,
126
- size=len(text),
127
- )
128
- ]
File without changes