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