deepset-ai / deepset-ai/haystack

Feedback on naming of Tool parameters

Open
#9,295 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P2
Dominant language
Python
Stars
26.6k
Forks
3.2k
Avg merge
1d 3h
Merged PRs (30d)
194

Description

I had a chance to talk with @deep-rloebbert and gather some feedback on the recent of Agent and the changes that came with Tools (e.g. adding outputs_to_string).

The naming of outputs_to_state and inputs_from_state resonated well with him, but there were a few suggestions for improvement.

  • Similar to how we have named the variables in SuperComponent input_mapping and output_mapping, @deep-rloebbert would find the names inputs_from_state_mapping and outputs_to_state_mapping more clear and consistent between our abstractions.
  • For the outputs_to_state_mapping a suggestion for rearranging the how the dictionary is passed to it:
    • Rename source to state_key to indicate where the output should go into state
    • Put the name of the final output first
    • Rename handler to aggregation_handler to make it clearer that the handler function handles aggregation
# Before
outputs_to_state_mapping:
  documents:
    source: documents_super_output
    handler: None

# After
outputs_to_state_mapping:
  documents_super_output:  # <-- Put the name of the final output first
    state_key: documents  # <-- Rename source to state_key
    aggregation_handler: None  # <-- Rename handler to aggregation_handler
  • Preference on renaming outputs_to_string to outputs_to_result_mapping since the string naming is confusing and unclear. So the hope here is that result_mapping better indicates how we'd like to transform the output of the tool into the final "result" which will be passed back to the LLM.
# Before
outputs_to_string:
  source: result
  handler: None

# After (can either pass only a string or dict
outputs_to_result_mapping: result  # <-- Add an option to just pass a string for convenience
# or
outputs_to_result_mapping:  # <-- current version that accepts a dict
  source: result
  handler: None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by reviewing the Tool and Agent parameter handling alongside the SuperComponent input_mapping and output_mapping abstractions; determine the migration and compatibility scope for the proposed names and mappings, then define tests that verify the revised configuration forms and final LLM result behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai, backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.