Web Scraping
zyx
comes with a quick way to scrape the web for information using agentic reasoning through LLMs with the scrape()
function.
Node-based scraping coming soon for more complex scraping tasks.
Simple Scraping
from zyx import scrape
result = scrape(
"The latest & hottest AI hardware",
model = "openai/gpt-4o"
workers = 5,
max_results = 3
)
print(result)
Output
...
'summary': "The AI hardware market has seen rapid advancements and fierce competition, with several key players releasing
innovative products to meet the growing demand for AI capabilities. Here are the most notable companies and their contributions to AI hardware
as of 2024:\n\n1. **Nvidia**: A leader in the AI hardware space, Nvidia's chips like the A100 and H100 are critical for data centers. The
recent introduction of the H200 and B200 chips, along with the Grace Hopper superchip, emphasizes Nvidia's focus on performance and
scalability in AI applications.\n\n2. **AMD**: AMD continues to compete with Nvidia, having launched its MI300 series of AI chips, which rival
Nvidia's offerings in terms of memory capacity and bandwidth. The new Zen 5 CPU microarchitecture enhances AMD's capabilities in AI
workloads.\n\n3. **Intel**: Intel has introduced its Xeon 6 processors and the Gaudi 3 AI accelerator, which aims to improve processing
efficiency. Intel's longstanding presence in the CPU market is now complemented by its focus on AI-specific hardware.\n\n4. **Alphabet
(Google)**: With its Cloud TPU v5p and the recently announced Trillium TPU, Alphabet is committed to developing powerful AI chips tailored for
large-scale machine learning tasks.\n\n5. **Amazon Web Services (AWS)**: AWS has shifted towards chip production with its Trainium and
Inferentia chips, designed for training and deploying machine learning models, respectively. Their latest instance types offer significant
improvements in memory and processing power.\n\n6. **Cerebras Systems**: Known for its wafer-scale engine, the WSE-3, Cerebras has achieved
remarkable performance with its massive core count and memory bandwidth, making it a strong contender in the AI hardware market.\n\n7.
**IBM**: IBM's AI Unit and the upcoming NorthPole chip focus on energy efficiency and performance improvements, aiming to compete with
existing AI processors.\n\n8. **Qualcomm**: Although newer to the AI hardware scene, Qualcomm's Cloud AI 100 chip has shown competitive
performance against Nvidia, particularly in data center applications.\n\n9. **Tenstorrent**: Founded by a former AMD architect, Tenstorrent
focuses on scalable AI hardware solutions, including its Wormhole processors.\n\n10. **Emerging Startups**: Companies like Groq, SambaNova
Systems, and Mythic are also making strides in the AI hardware space, offering specialized solutions for AI workloads.\n\nIn summary, the
competitive landscape for AI hardware is characterized by rapid innovation, with established tech giants and emerging startups alike vying to
create the most powerful and efficient AI chips. This ongoing evolution is driven by the increasing demands of AI applications, particularly
in data centers and for large-scale machine learning models.",
'evaluation': {
'is_successful': True,
'explanation': 'The summary effectively captures the current landscape of AI hardware as of 2024, highlighting key players and
their contributions. It provides relevant details about the advancements made by major companies like Nvidia, AMD, Intel, and others, which
directly relates to the query about the latest and hottest AI hardware. The structure is clear, listing companies and their innovations,
making it easy for readers to understand the competitive dynamics in the AI hardware market. Overall, the summary is comprehensive, relevant,
and well-organized, making it a successful response to the query.',
'content': None
}
}
},
messages=[]
)
API Reference
Scrapes the web for topics & content about multiple queries, generates a well-written summary, and returns a Document object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
The initial search query. |
required |
num_queries
|
int
|
Number of queries to generate based on the initial query. |
5
|
max_results
|
Optional[int]
|
Maximum number of search results to process. |
5
|
workers
|
int
|
Number of worker threads to use. |
5
|
model
|
str
|
The model to use for completion. |
'gpt-4o-mini'
|
client
|
Literal['openai', 'litellm']
|
The client to use for completion. |
'openai'
|
api_key
|
Optional[str]
|
The API key to use for completion. |
None
|
base_url
|
Optional[str]
|
The base URL to use for completion. |
None
|
mode
|
InstructorMode
|
The mode to use for completion. |
'tool_call'
|
max_retries
|
int
|
The maximum number of retries to use for completion. |
3
|
temperature
|
float
|
The temperature to use for completion. |
0.5
|
run_tools
|
Optional[bool]
|
Whether to run tools for completion. |
False
|
tools
|
Optional[List[ToolType]]
|
The tools to use for completion. |
None
|
Returns:
Type | Description |
---|---|
Document
|
A Document object containing the summary and metadata. |
Source code in zyx/resources/completions/agents/scrape.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 |
|