mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-08-29 04:26:20 +00:00
fix(ingest): prevent mutable options mutation in batch/multi-example calls
Deep-copy **options in ingest_examples and batch_public_apis so that mutable values (e.g. params dicts) are not shared across iterations. Add rate_limit_delay to the config_only_key strip list in ingest_public_api so it is not forwarded twice when passed via kwargs.
This commit is contained in:
@@ -552,6 +552,7 @@ def ingest_public_api(
|
||||
"delay",
|
||||
"fail_fast",
|
||||
"max_retries",
|
||||
"rate_limit_delay",
|
||||
"validate_no_auth",
|
||||
):
|
||||
request_kwargs.pop(config_only_key, None)
|
||||
|
||||
@@ -565,7 +565,7 @@ class PublicAPIIngestor(RESTIngestor):
|
||||
|
||||
def ingest_examples(self, names: List[str], **options) -> List[APIData]:
|
||||
"""Ingest multiple pre-configured public API examples."""
|
||||
return [self.ingest_example(name, **options) for name in names]
|
||||
return [self.ingest_example(name, **copy.deepcopy(options)) for name in names]
|
||||
|
||||
def batch_public_apis(
|
||||
self,
|
||||
@@ -578,7 +578,7 @@ class PublicAPIIngestor(RESTIngestor):
|
||||
for endpoint in endpoints:
|
||||
try:
|
||||
results.append(
|
||||
self.ingest_public_api(endpoint, method=method, **options)
|
||||
self.ingest_public_api(endpoint, method=method, **copy.deepcopy(options))
|
||||
)
|
||||
except Exception as exc:
|
||||
self.logger.warning(f"Failed to fetch public API {endpoint}: {exc}")
|
||||
|
||||
Reference in New Issue
Block a user