mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-11 08:38:24 +00:00
fix(exa): retain stream metadata and price instant searches
This commit is contained in:
parent
d150fb91db
commit
78acd12678
4 changed files with 22 additions and 1 deletions
|
|
@ -137,11 +137,15 @@ class SearchStreamWrapper:
|
|||
raise self._error("Malformed search stream event") from error
|
||||
payload: Final = TypeAdapter(Mapping[str, object]).validate_python(event.model_dump())
|
||||
if "requestId" in payload:
|
||||
self._request_metadata = {"requestId": payload["requestId"]}
|
||||
self._request_metadata = {**self._request_metadata, "requestId": payload["requestId"]}
|
||||
if event.type == "error":
|
||||
raise self._error(f"Search stream error: {payload.get('error')}", body=payload)
|
||||
if event.type == "results":
|
||||
self._results = payload.get("results", [])
|
||||
self._request_metadata = {
|
||||
**self._request_metadata,
|
||||
**{key: value for key, value in payload.items() if key not in ("type", "results")},
|
||||
}
|
||||
if event.type == "done":
|
||||
self._finished = True
|
||||
completed: Final = {key: value for key, value in payload.items() if key != "type"}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ EXA_AI_ADDITIONAL_RESULT_COST: Final = 0.001
|
|||
EXA_AI_STANDARD_SEARCH_MODEL: Final = "exa_ai/search"
|
||||
EXA_AI_PRICING_MODEL_BY_TYPE: Final[Mapping[str, str]] = MappingProxyType(
|
||||
{
|
||||
"instant": "exa_ai/search-instant",
|
||||
"deep-lite": "exa_ai/search-deep",
|
||||
"deep": "exa_ai/search-deep",
|
||||
"deep-reasoning": "exa_ai/search-deep-reasoning",
|
||||
|
|
|
|||
|
|
@ -23892,6 +23892,14 @@
|
|||
},
|
||||
"mode": "search"
|
||||
},
|
||||
"exa_ai/search-instant": {
|
||||
"input_cost_per_query": 0.004,
|
||||
"litellm_provider": "exa_ai",
|
||||
"metadata": {
|
||||
"notes": "Base price per /search request with type instant, covering up to 10 results. Source: https://exa.ai/pricing (2026-10-15)"
|
||||
},
|
||||
"mode": "search"
|
||||
},
|
||||
"exa_ai/search-deep": {
|
||||
"input_cost_per_query": 0.012,
|
||||
"litellm_provider": "exa_ai",
|
||||
|
|
|
|||
|
|
@ -23892,6 +23892,14 @@
|
|||
},
|
||||
"mode": "search"
|
||||
},
|
||||
"exa_ai/search-instant": {
|
||||
"input_cost_per_query": 0.004,
|
||||
"litellm_provider": "exa_ai",
|
||||
"metadata": {
|
||||
"notes": "Base price per /search request with type instant, covering up to 10 results. Source: https://exa.ai/pricing (2026-10-15)"
|
||||
},
|
||||
"mode": "search"
|
||||
},
|
||||
"exa_ai/search-deep": {
|
||||
"input_cost_per_query": 0.012,
|
||||
"litellm_provider": "exa_ai",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue