{"id":20944895,"url":"https://github.com/liamca/superrag","last_synced_at":"2025-04-11T16:20:25.753Z","repository":{"id":239637257,"uuid":"792335858","full_name":"liamca/superrag","owner":"liamca","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-26T15:53:48.000Z","size":16,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T12:21:55.708Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liamca.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-26T13:10:00.000Z","updated_at":"2024-07-24T06:52:05.000Z","dependencies_parsed_at":"2024-05-13T19:30:16.130Z","dependency_job_id":"5ae294bf-d6c3-4bf8-8525-319d2701ea09","html_url":"https://github.com/liamca/superrag","commit_stats":null,"previous_names":["liamca/superrag"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liamca%2Fsuperrag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liamca%2Fsuperrag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liamca%2Fsuperrag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liamca%2Fsuperrag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liamca","download_url":"https://codeload.github.com/liamca/superrag/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248438471,"owners_count":21103410,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T23:45:51.911Z","updated_at":"2025-04-11T16:20:25.727Z","avatar_url":"https://github.com/liamca.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SuperRAG\n\nThis repo is intended to demonstrate how to leverage Azure OpenAI as a reranking layer in the RAG pattern to improve the accuracy of the retrieved search resuts.\n\n## Why SuperRAG?\n\nHybrid and Vector retrieval approaches are typically very good at helping to retrieve content semantically similar to the users question, however they are not typically great at identifying the intent of the users question and prioritizing content retrievaly that best matches the intent of the question. SuperRAG intends to solve this by leveraging Azure OpenAI's ability to understand intent and help to rerank results that best match the intent.\n\n## Semantics vs Intent\n\nThe semantics of a question refer to the meaning or the interpretation of the words and phrases within the question. It's about understanding what the question is asking on a linguistic level, considering the vocabulary, grammar, and structure. Semantics focuses on the literal meaning conveyed by the elements of the question. \n\nThe intent of a question, on the other hand, goes beyond the literal meaning to understand the purpose or the reason why the question is being asked. It's about grasping what the asker is looking for or hoping to achieve with the question. \n\n### Example\nTake the following example a user might ask:\n\n```\nQuestion: \"Where's a good place to eat around here?\"\n```\n\nFrom with the following content might be retrieved from the Hybrid or Vector database:\n```\nDoc1: There are many places to eat in this city.\nDoc2: If you're in the mood for Italian, Mario's on 5th Street is fantastic. Their pasta is the best in town, and they have a lovely atmosphere\n```\n\nDoc1 matches the *semantics* of question with words like “Eat” and “Around here” being semantically similar to “this city”, but Doc2 is better because it matches the *intent* of the question.\n\n## Azure OpenAI and Intent\n\nLet's now look at how we can potentially use Azure OpenAI to help with the intent matching. Using Azure AI Studio we can see in this image how a simple prompt can be used to not only find the likelihood (confidence) that the response matched the intent, but also generate a reason why.\n\n ![image](https://github.com/liamca/superrag/assets/3432973/868ce37c-5f28-4c36-bf1c-efa1d816bb17)\n\n Here is a good starting point for a prompt. You will likely need to adjust based on your own needs.\n\n```\nI am going to supply you with a set of potential answers and your goal is to determine which of them is best able to answer the question:\n\"\"\" +  question + \"\"\"\nPlease respond in JSON format with a \"confidence\" score for each example indicating your confidence the text answers the question as well as the \"id\" of the text.  \nInclude a field called \"relevent_text\" which includes the text that is relevent to being able to answer the question.  \nEach example will include an answer id as well as the text for the potential answer, separated by a colon.\n```\n\n## Architecture\n\nThe following diagram outlines the architectural flow.\n![image](https://github.com/liamca/superrag/assets/3432973/105858ee-5495-4875-a00b-c154757067e1)\n\n## Demo\n\nPlease see the notebook included to see more details on how to rerank results using Azure OpenAI\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliamca%2Fsuperrag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliamca%2Fsuperrag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliamca%2Fsuperrag/lists"}