Skip to content

Commit f3efc30

Browse files
RafaelPogithub-actions[bot]
authored andcommitted
feat: add document_query_llm config to agent-map operation (#5108)
## Summary - Adds a new optional `document_query_llm` field to the `AgentMapOperation` API request, allowing users to specify which LLM the `QueryDocumentLLM` (QDLLM) tool uses when scraping web pages - Threads the field through `AgentQueryParams` → `setup_agent_components` → `QueryDocumentLLM` constructor - Fully backward-compatible: when not provided, QDLLM uses its existing default (`DEFAULT_SMALL`) ## Test plan - [ ] Verify agent-map works without `document_query_llm` (existing behavior unchanged) - [ ] Verify agent-map with `document_query_llm` set to a valid `LLMEnumPublic` value uses the specified model for QDLLM - [ ] Verify validation rejects invalid enum values 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Sourced from commit f06e977f5c8ef0f88e9a54cad8fca39747735b98
1 parent f59f5b1 commit f3efc30

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

src/futuresearch/generated/models/agent_map_operation.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class AgentMapOperation:
4949
affected by other agents. Disables adaptive budget adjustment and straggler management, ensuring agents are not
5050
hurried or given iteration limits based on other agents' progress. Use this when consistent per-row behavior is
5151
more important than overall throughput. Default: False.
52+
document_query_llm (LLMEnumPublic | None | Unset): LLM to use for the document query tool (QDLLM) that reads and
53+
extracts information from web pages. If not provided, defaults to the system default.
5254
"""
5355

5456
input_: AgentMapOperationInputType2 | list[AgentMapOperationInputType1Item] | UUID
@@ -63,6 +65,7 @@ class AgentMapOperation:
6365
include_reasoning: bool | None | Unset = UNSET
6466
include_research: bool | None | Unset = UNSET
6567
enforce_row_independence: bool | Unset = False
68+
document_query_llm: LLMEnumPublic | None | Unset = UNSET
6669
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
6770

6871
def to_dict(self) -> dict[str, Any]:
@@ -142,6 +145,14 @@ def to_dict(self) -> dict[str, Any]:
142145

143146
enforce_row_independence = self.enforce_row_independence
144147

148+
document_query_llm: None | str | Unset
149+
if isinstance(self.document_query_llm, Unset):
150+
document_query_llm = UNSET
151+
elif isinstance(self.document_query_llm, LLMEnumPublic):
152+
document_query_llm = self.document_query_llm.value
153+
else:
154+
document_query_llm = self.document_query_llm
155+
145156
field_dict: dict[str, Any] = {}
146157
field_dict.update(self.additional_properties)
147158
field_dict.update(
@@ -170,6 +181,8 @@ def to_dict(self) -> dict[str, Any]:
170181
field_dict["include_research"] = include_research
171182
if enforce_row_independence is not UNSET:
172183
field_dict["enforce_row_independence"] = enforce_row_independence
184+
if document_query_llm is not UNSET:
185+
field_dict["document_query_llm"] = document_query_llm
173186

174187
return field_dict
175188

@@ -321,6 +334,23 @@ def _parse_include_research(data: object) -> bool | None | Unset:
321334

322335
enforce_row_independence = d.pop("enforce_row_independence", UNSET)
323336

337+
def _parse_document_query_llm(data: object) -> LLMEnumPublic | None | Unset:
338+
if data is None:
339+
return data
340+
if isinstance(data, Unset):
341+
return data
342+
try:
343+
if not isinstance(data, str):
344+
raise TypeError()
345+
document_query_llm_type_0 = LLMEnumPublic(data)
346+
347+
return document_query_llm_type_0
348+
except (TypeError, ValueError, AttributeError, KeyError):
349+
pass
350+
return cast(LLMEnumPublic | None | Unset, data)
351+
352+
document_query_llm = _parse_document_query_llm(d.pop("document_query_llm", UNSET))
353+
324354
agent_map_operation = cls(
325355
input_=input_,
326356
task=task,
@@ -334,6 +364,7 @@ def _parse_include_research(data: object) -> bool | None | Unset:
334364
include_reasoning=include_reasoning,
335365
include_research=include_research,
336366
enforce_row_independence=enforce_row_independence,
367+
document_query_llm=document_query_llm,
337368
)
338369

339370
agent_map_operation.additional_properties = d

src/futuresearch/ops.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ async def agent_map(
289289
include_reasoning: bool | None = None,
290290
enforce_row_independence: bool = False,
291291
response_model: type[BaseModel] = DefaultAgentResponse,
292+
document_query_llm: LLM | None = None,
292293
) -> TableResult:
293294
"""Execute an AI agent task on each row of the input table.
294295
@@ -302,6 +303,7 @@ async def agent_map(
302303
iteration_budget: Number of agent iterations per row (0-20). Required when effort_level is None.
303304
include_reasoning: Include reasoning notes. Required when effort_level is None.
304305
response_model: Pydantic model for the response schema.
306+
document_query_llm: LLM to use for the document query tool (QDLLM) when scraping web pages.
305307
306308
Returns:
307309
TableResult containing the agent results merged with input rows.
@@ -320,6 +322,7 @@ async def agent_map(
320322
include_reasoning=include_reasoning,
321323
enforce_row_independence=enforce_row_independence,
322324
response_model=response_model,
325+
document_query_llm=document_query_llm,
323326
)
324327
result = await cohort_task.await_result()
325328
if isinstance(result, TableResult):
@@ -335,6 +338,7 @@ async def agent_map(
335338
include_reasoning=include_reasoning,
336339
enforce_row_independence=enforce_row_independence,
337340
response_model=response_model,
341+
document_query_llm=document_query_llm,
338342
)
339343
result = await cohort_task.await_result()
340344
if isinstance(result, TableResult):
@@ -352,6 +356,7 @@ async def agent_map_async(
352356
include_reasoning: bool | None = None,
353357
enforce_row_independence: bool = False,
354358
response_model: type[BaseModel] = DefaultAgentResponse,
359+
document_query_llm: LLM | None = None,
355360
) -> EveryrowTask[BaseModel]:
356361
"""Submit an agent_map task asynchronously."""
357362
input_data = _prepare_table_input(input, AgentMapOperationInputType1Item)
@@ -372,6 +377,9 @@ async def agent_map_async(
372377
include_reasoning=include_reasoning if include_reasoning is not None else UNSET,
373378
join_with_input=True,
374379
enforce_row_independence=enforce_row_independence,
380+
document_query_llm=LLMEnumPublic(document_query_llm.value)
381+
if document_query_llm is not None
382+
else UNSET,
375383
)
376384

377385
response = await agent_map_operations_agent_map_post.asyncio(

0 commit comments

Comments
 (0)