Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementations to build the Flare (Forward-Looking Active REtrieval augmented generation) pattern with LangStream #548

Merged
merged 20 commits into from
Oct 10, 2023

Conversation

eolivelli
Copy link
Member

@eolivelli eolivelli commented Oct 6, 2023

This patch includes a set of improvements needed to support the Flare pattern.

Side implementations:

  • add support for "loop-over" in the "query"/"query-vector-db" agents
  • add support for "loop-over" in the "compute-ai-embeddings" agents
  • enhance the error message when you try to access a property on a message that has malformed JSON
  • fix "logprobs" field in "ai-text-embeddings", it must be a map and not a JSON string

Flare implementation:

Notes:
Flare can be used only with OpenAI (/Azure) and only with the text-completion API because you need the "logprobs" feature.

How it works:

  • the text-generation agents output a result together with the logprobs (probability of certainty) for all the returned tokens
  • the flare-controller finds sub sequences in the answer that are with low confidence
  • in case there are log confidence sequences then the flare-controller puts back the message into a loop and requests more documents for retrieval in order to help the LLM

There is some protection mechanism that prevents to run too many iterations on the same message.

@eolivelli eolivelli marked this pull request as ready for review October 10, 2023 15:49
@eolivelli eolivelli changed the title Implementations to build the Flare pattern with LangStream Implementations to build the Flare (Forward-Looking Active REtrieval augmented generation) pattern with LangStream Oct 10, 2023
@eolivelli eolivelli merged commit d8e109a into main Oct 10, 2023
9 checks passed
@eolivelli eolivelli deleted the impl/flare branch October 10, 2023 19:28
benfrank241 pushed a commit to vectorize-io/langstream that referenced this pull request May 2, 2024
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.

None yet

1 participant