OpenFn / OpenFn/apollo

job_chat: errors can be made if rag results come from multiple adaptors

Open
#211 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
5
Forks
10
Avg merge
2d 20h
Merged PRs (30d)
17

Description

Basically because the rag searches all api docs, there's scope that results can be returned from commcare even if I'm using OpenMRS

Sometimes we probably want to restrict results to a single adaptor. Other times it's appropriate to search multiple adaptors. So I'm not sure of the fix.

Original report from Joe:

Ah, one large error has just come up because the rag has returned hits from multiple adaptors, and so the assistant is confused about which API is available. So it's included code from the wrong adaptor.

Wisdom from Hanna:

I could add a contextualising sentence for each retrieved chunk e.g. "from <title> docs: " ? Theoretically the user could be asking about other adaptors so we probably don't want to filter by section title for the adaptors?

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

Start by tracing how job_chat searches API documentation through RAG and how adaptor context is represented in retrieved results. Compare single-adaptor requests with questions that intentionally span multiple adaptors, then establish the expected behavior and a reproducible test for mixed-adaptor results. Done means the assistant consistently uses the appropriate adaptor context.

Written by the indexing model from the issue text.

Assessment

Domain
ai
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.