Ez agent nek keszul shema hogy hasznalja az exa ai t from e...
Prompt
Ez agent nek keszul shema hogy hasznalja az exa ai t from exa_py import Exa import json import re import unicodedata from datetime import datetime, timezone exa = Exa(api_key="8961cb7d-b016-4d18-8986-c1bca70344ca") query = "herecomesquery" summary_query = """herecomessummaryquery""" exclude_domains_raw = """herecomesexcludedomains""" def normalize_domain(raw_domain: object) -> str: domain = str(raw_domain).strip().strip("\"'[](){}<>").strip() domain = re.sub(r"^[a-zA-Z][a-zA-Z0-9+.-]*://", "", domain) domain = re.split(r"[/?#]", domain, maxsplit=1)[0] domain = domain.rsplit("@", 1)[-1] domain = re.sub(r":\d+$", "", domain) domain = domain.strip(".").lower() return domain if isinstance(exclude_domains_raw, str): raw_domain_entries = re.split(r"[,\s;]+", exclude_domains_raw) else: raw_domain_entries = list(exclude_domains_raw) exclude_domains: list[str] = [] for raw_domain_entry in raw_domain_entries: normalized_domain = normalize_domain(raw_domain_entry) if normalized_domain and normalized_domain not in exclude_domains: exclude_domains.append(normalized_domain) result = exa.search_and_contents( query, exclude_domains=exclude_domains if exclude_domains else None, num_results=100, type="deep-reasoning", summary={"query": summary_query}, ) summaries = [ { "summary": getattr(search_result, "summary", None) } for search_result in result.results ] normalized_query = unicodedata.normalize("NFKD", query) ascii_query = normalized_query.encode("ascii", "ignore").decode("ascii") filename_query = re.sub(r"[^a-zA-Z0-9]+", "_", ascii_query).strip("_").lower() filename_query = filename_query[:100].rstrip("_") if not filename_query: filename_query = "query" timestamp = datetime.now(timezone.utc).strftime("%Y%m%d_%H%M%S_%f") output_filename = f"{filename_query}_{timestamp}.json" with open(output_filename, "w", encoding="utf-8") as json_file: json.dump(summaries, json_file, ensure_ascii=False, indent=2) print(output_filename) Egeszitsd ki legyen benne minden: --- name: exa-search With filters and freshness bash curl -sS -X POST "https://api.exa.ai/search" \ -H "Content-Type: application/json" \ -H "x-api-key: $EXA_API_KEY" \ -d '{ "query": "AI regulation policy updates", "type": "instant", "category": "news", "numResults": 100, "includeDomains": ["reuters.com", "bbc.com"], "startPublishedDate": "2025-01-01", "contents": { "text": { "maxCharacters": 2000 }, "maxAgeHours": 24, "livecrawlTimeout": 12000 } }' Deep search bash curl -sS -X POST "https://api.exa.ai/search" \ -H "Content-Type: application/json" \ -H "x-api-key: $EXA_API_KEY" \ -d '{ "query": "map the major technical and commercial tradeoffs in sodium-ion batteries for grid storage", "type": "deep", "numResults": 100 }' Paraméter Típus Kötelező Alapértelmezett Leírás query string Igen - Természetes nyelvű keresési lekérdezés. A hosszú, szemantikailag gazdag leírások jól működnek. type string Nem auto Keresési módszer: auto, fast, instant, deep-lite, deep vagy deep-reasoning. numResults integer Nem 100 Visszaadandó találatok száma. Ügynök ciklusokhoz használj kis értékeket; maximum 100. category string Nem - Speciális eredménytípus: company, people, research paper, news, personal site vagy financial report. includeDomains string[] Nem - Csak ezekből a domainekből, útvonalakból vagy helyettesítő mintákból adjon vissza eredményeket. Max 1200. excludeDomains string[] Nem - Ezeket a domaineket, útvonalakat vagy helyettesítő mintákat zárja ki. Max 1200. startPublishedDate string Nem - ISO 8601 alsó határérték az eredmény közzétételének dátumához. endPublishedDate string Nem - ISO 8601 felső határérték az eredmény közzétételének dátumához. additionalQueries string[] Nem - Extra lekérdezési változatok mély keresési variánsokhoz. A fő lekérdezés mellett használandó. systemPrompt string Nem - Utasítások a szintetizált kimenethez és a mély keresés tervezéséhez, például forrásbeállítások. outputSchema object Nem - JSON séma, amely az output.content-et vezérli. Szintetizált kimenetet és megalapozást ad hozzá. stream boolean Nem false Ha igaz, SSE-t ad vissza egyetlen JSON válasz helyett. compliance string Nem - Csak vállalati megfelelési mód, például hipaa, ha engedélyezve van a fiókhoz On /search, text, and summary must be nested under contents. Paraméter Típus Kötelező Alapértelmezett Leírás contents.summary boolean vagy object Nem - Eredményenkénti LLM összefoglalókat ad vissza. Összefoglaló objektum beállításai Paraméter Típus Alapértelmezett Leírás query string - Egyedi lekérdezés az összefoglalóhoz. schema object - JSON séma strukturált eredményenkénti összefoglalókhoz. Keresési típusok A keresési típus szabályozza a lekérési és szintézis módot. Válaszd a módot a munkafolyamathoz, ne csak a kimeneti formátumhoz. Az outputSchema bármely keresési típussal használható; mélyebb módokat akkor alkalmazz, ha maga a keresési folyamat több tervezést, szintézist vagy következtetést igényel. Típus Legjobb erre Kompromisszum auto Általános alapértelmezett keresés és legtöbb új integráció Egyensúlyt teremt sebesség és minőség között anélkül, hogy a hívónak finomítania kellene a lekérési stratégiát. fast Kis késleltetésű ügynök ciklusok és termék útvonalak Gyorsabb az auto-nál; akkor használd, ha a válaszkészség fontosabb a maximális következtetési mélységnél. instant Valós idejű felhasználói felület, chat, hang és automatikus kiegészítés Legkisebb késleltetési útvonal; gyors lekéréshez használd, nem mély szintézishez. deep-lite Könnyű kutatás vagy szintézis Több tervezést és szintézist ad az auto-nál, miközben könnyebb marad a teljes deep-nél. deep Többlépéses kutatás, összehasonlítások és szintézis-igényes lekérés Nagyobb késleltetés; jobb, ha a lekérdezésnek több forráson át kell feltárnia. deep-reasoning Nehéz kutatási feladatok nagy kétértelműséggel vagy összetett kompromisszumokkal Legnagyobb késleltetés és következtetési mélység Use auto unless latency or reasoning depth is the primary constraint. Use fast or instant for time-sensitive calls. Use deep, deep-lite, or deep-reasoning when the query needs multi-step source discovery, comparison, or synthesis. Mode-only examples json { "query": "recent product launches from major AI chip companies", "type": "fast", "numResults": 100 } json { "query": "compare competing explanations for the recent rise in grid-scale battery deployments", "type": "deep", "numResults": 100 } Structured Output Use systemPrompt for behavior and outputSchema for shape. Keep the schema compact: a handful of named fields, shallow nesting, arrays that declare items. The example below is about as wide as /search wants. If you need more columns, drop the least important ones rather than grow the schema. bash curl -sS -X POST "https://api.exa.ai/search" \ -H "Content-Type: application/json" \ -H "x-api-key: $EXA_API_KEY" \ -d '{ "query": "compare the latest frontier AI model releases", "type": "deep", "systemPrompt": "Prefer official sources and avoid duplicate results.", "outputSchema": { "type": "object", "properties": { "models": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "notable_claims": { "type": "array", "items": { "type": "string" } } }, "required": ["name", "notable_claims"] } } }, "required": ["models"] }, "contents": { "summary": true } }' Keep schemas compact and bounded. Do not add citation fields to the schema; grounding is returned separately in output.grounding. Streaming Streaming applies to synthesized output, so include outputSchema along with -N, Accept: text/event-stream, and stream: true. Without outputSchema, the endpoint returns the normal JSON search response even when stream is true. bash curl -sS -N -X POST "https://api.exa.ai/search" \ -H "Content-Type: application/json" \ -H "Accept: text/event-stream" \ -H "x-api-key: $EXA_API_KEY" \ -d '{ "query": "recent grid-scale battery deployments", "type": "deep", "stream": true, "outputSchema": { "type": "object", "properties": { "summary": { "type": "string" } }, "required": ["summary"] }, "contents": { "summary": true } }' Treat streaming as SSE rather than JSON. Each data: frame contains an OpenAI-compatible chat completion chunk; read partial text from choices[0].delta.content and handle completion or error frames defensively. Response Fields | Field | Type | Description | | --- | --- | --- | | requestId | string | Unique request identifier. | | results | array | Ranked result objects. | | results[].title | string | Page title. | | results[].url | string | Page URL. | | results[].publishedDate | string or null | Estimated publication date when available. | | results[].author | string or null | Author when available. | | results[].text | string | Returned when contents.text is requested. | | results[].summary | string | Returned when contents.summary is requested. | | results[].subpages | array | Nested result objects from subpage crawling. | | results[].extras.links | string[] | Extracted links when requested. | | output.content | string or object | Synthesized output when outputSchema is provided. | | searchTime | number | Search latency when returned. | Critical Pitfalls - Keep text, and summary inside contents on /search. - Do not send top-level text, or summary; that shape belongs to /contents. - Do not send tokensNum; use contents.text.maxCharacters to cap extracted text. - Do not use useAutoprompt, numSentences in new requests. - Use documented categories only: company, people, research paper, news, personal site, and financial report. - Pick one of contents.text, or contents.summary by default. - Expect SSE only when stream: true is paired with outputSchema; otherwise /search returns its normal JSON response. Teljes kódot kijavítva vissza küldöd. minden egyes karaktert leírsz, nem rövidítesz. minden hibát kijavítasz. egy fájl marad. ne írj semmi mást csak a teljes kódot es kommentek nem lehetnek benne! soha semmi egyszerusitett mock placeholder dummy szimulalt fake szart nem engedelyezek es teljes fájl roviditetlen production ready kód egy kód mezőbe írjad a teljes kódot es legyen 100% osan hiba mentes!
Response not available
Response not available