refactor(core): replace float('inf') with math.inf

Replace float('inf') and float('-inf') with math.inf and -math.inf from the math module for better readability and performance. Also clean up imports and remove unused speed comparison code.

No breaking changes.
This commit is contained in:
UncleCode
2025-03-04 18:23:55 +08:00
parent f334daa979
commit 415c1c5bee
5 changed files with 16 additions and 72 deletions

View File

@@ -1,10 +1,11 @@
from crawl4ai.async_configs import LlmConfig
from crawl4ai.extraction_strategy import *
from crawl4ai.crawler_strategy import *
from crawl4ai import AsyncWebCrawler, LLMExtractionStrategy
import asyncio
import os
import json
from pydantic import BaseModel, Field
url = r"https://openai.com/api/pricing/"
url = "https://openai.com/api/pricing/"
class OpenAIModelFee(BaseModel):
@@ -14,10 +15,6 @@ class OpenAIModelFee(BaseModel):
..., description="Fee for output token for the OpenAI model."
)
from crawl4ai import AsyncWebCrawler
async def main():
# Use AsyncWebCrawler
async with AsyncWebCrawler() as crawler: