Skip to content

[DEV-15167] implement recipient lookup tool#4683

Merged
james-at-kc merged 14 commits into
qatfrom
ftr/DEV-15167-implement-recipient-lookup-tool
Jul 14, 2026
Merged

[DEV-15167] implement recipient lookup tool#4683
james-at-kc merged 14 commits into
qatfrom
ftr/DEV-15167-implement-recipient-lookup-tool

Conversation

@james-at-kc

@james-at-kc james-at-kc commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Description:

Search the recipients index in OpenSearch to find the most relevant results that can then be passed to the Advanced Search query. Cris may have insights from the filter semantic sessions for how to implement this filter.

Technical Details:

The lookup_recipient tool should look for matches on the following fields: recipient_name, uei, duns

The lookup_recipient tool returns a list of recipient names.

The tool should query the recipient OpenSearch index a single time to find a relevant match

Test cases are created to capture different scenarios for the filter, including the usage of fuzzy matching

Requirements for PR Merge:

  1. Unit & integration tests updated
  2. API documentation updated (examples listed below)
    1. API Contracts
    2. API UI
    3. Comments
  3. Data validation completed (examples listed below)
    1. Does this work well with the current frontend? Or is the frontend aware of a needed change?
    2. Is performance impacted in the changes (e.g., API, pipeline, downloads, etc.)?
    3. Is the expected data returned with the expected format?
  4. Appropriate Operations ticket(s) created
  5. Jira Ticket(s)
    1. DEV-15167

Explain N/A in above checklist:

@james-at-kc
james-at-kc changed the base branch from master to qat July 1, 2026 12:12
@james-at-kc
james-at-kc marked this pull request as ready for review July 1, 2026 12:13
@aguest-kc aguest-kc changed the title Ftr/dev 15167 implement recipient lookup tool [DEV-15167] implement recipient lookup tool Jul 6, 2026

@zachflanders-frb zachflanders-frb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pulled this code down and tried it locally. The results seem good! I am requesting changes in order to

  • use opensearchpy instead of elasticsearch_dsl library
  • move the functions in recipient_retrieval into a helpers file in the tests directory
  • Update the return value of the lookup tool to be a list of strings and remove the pydantic models from py_models (this one does not follow the pattern of the selectedLocations)

Additionally, it is my preference that we punt on the subcontractors lookup until later and potentially make it a separate tool, but would love others to weigh in on this too.

Comment thread usaspending_api/llm/tools/lookup_recipient.py Outdated
Comment thread usaspending_api/llm/tests/helper.py
Comment thread usaspending_api/llm/models/py_models.py Outdated
Comment thread usaspending_api/llm/tools/lookup_recipient.py Outdated
Comment thread usaspending_api/llm/tools/lookup_recipient.py Outdated
Comment thread usaspending_api/llm/tools/lookup_recipient.py Outdated
@james-at-kc
james-at-kc merged commit c43f287 into qat Jul 14, 2026
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants