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

Feature/semantic routing #540

Merged
merged 25 commits into from
Jun 10, 2024
Merged

Feature/semantic routing #540

merged 25 commits into from
Jun 10, 2024

Conversation

andy-symonds
Copy link
Contributor

@andy-symonds andy-symonds commented Jun 7, 2024

Context

This PR adds the semantic routing to rag chat using the semantic router library, adding 5 routes, 3 with pre-canned response and 2 placeholder routes for summarisation and extraction.

Changes proposed in this pull request

Additionally, renamed services.py to dependencies.py. We needed to use HuggingFaceEncoder from the semantic-router library - if we use the OpenAIEncoder from the semantic-router library we get nasty errors, which could be a dynamic linking issuing. HuggingFaceEncorder does the job fine, but can be revisited in future.

Guidance to review

Non-streaming endpoint can be checked using Swagger UI and test_rag_chat, however, to test streaming endpoint you would need to go through Django-app. Integration tests added go through streaming endpoint and pass.

The build_chain function is used for streaming semantic routing, but does not currently work as-is for the non-streaming endpoint. As a result the non-streaming endpoint has some additional code that can be refactored out in future in favour of using the build_chain function. Getting the semantic router library into the codebase and working took priority over and this tech debt should be fixed in due course.

Created a build_vanilla_chain function ready to use, but as we are not using vanilla chat just yet, it is not yet used in streaming endpoint.

Once decision to approved, this PR shout be merged to main only after PR #539

Relevant links

Things to check

  • [] I have added any new ENV vars in all deployed environments
  • I have tested any code added or changed
  • I have run integration tests

andy-symonds and others added 18 commits June 5, 2024 17:48
…mmarisation and extract and some utterances for each route
…ing to also work. Extended semantic routing to include summarisation and extraction
Copy link
Collaborator

@gecBurton gecBurton left a comment

Choose a reason for hiding this comment

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

tested in preprod:

  • it works very nicely
  • i will make some minor formatting changes

"""

ABILITY_RESPONSE = """
* I can help you search over selected documents and do Q&A on them.
Copy link
Collaborator

Choose a reason for hiding this comment

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

our markdown formatter in the front end is interpreting:

long lines of text that go on and on and on and have new line continuation mark like this \
in them as code and assigns them the <code> tag which isnt what we want

image

so i have stripped them out

@gecBurton gecBurton merged commit 0b3ab51 into main Jun 10, 2024
11 checks passed
@gecBurton gecBurton deleted the feature/semantic-routing branch June 10, 2024 10:47
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.

2 participants