{"id":13560913,"url":"https://github.com/thinktecture-labs/semantic-kernel-semanticsearch","last_synced_at":"2025-04-03T16:31:24.896Z","repository":{"id":160414131,"uuid":"630898255","full_name":"thinktecture-labs/semantic-kernel-semanticsearch","owner":"thinktecture-labs","description":"Example how to implement a question \u0026 answer flow using semantic search with OpenAI - by using C# \u0026 Semantic Kernel","archived":false,"fork":false,"pushed_at":"2024-05-06T11:26:06.000Z","size":313,"stargazers_count":25,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-04T12:40:06.456Z","etag":null,"topics":["dotnet","embeddings","generative-ai","llms","openai","semantic-kernel","semantic-search"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thinktecture-labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-04-21T12:14:13.000Z","updated_at":"2024-09-18T18:28:23.000Z","dependencies_parsed_at":"2023-10-14T17:26:06.340Z","dependency_job_id":"5ee22db5-43ab-43bd-86af-bc3c23c9ba2b","html_url":"https://github.com/thinktecture-labs/semantic-kernel-semanticsearch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinktecture-labs%2Fsemantic-kernel-semanticsearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinktecture-labs%2Fsemantic-kernel-semanticsearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinktecture-labs%2Fsemantic-kernel-semanticsearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinktecture-labs%2Fsemantic-kernel-semanticsearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thinktecture-labs","download_url":"https://codeload.github.com/thinktecture-labs/semantic-kernel-semanticsearch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247037007,"owners_count":20873077,"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":["dotnet","embeddings","generative-ai","llms","openai","semantic-kernel","semantic-search"],"created_at":"2024-08-01T13:00:50.774Z","updated_at":"2025-04-03T16:31:24.498Z","avatar_url":"https://github.com/thinktecture-labs.png","language":"C#","funding_links":[],"categories":["Open Source Projects"],"sub_categories":[],"readme":"# Question \u0026 Answer flow with C# \u0026 Semantic Kernel\n\nA sample implementation of a question \u0026 answer flow using [Semantic Kernel](https://github.com/microsoft/semantic-kernel).\n\nThis uses sqlite to store embeddings (caution: sqlite is not vector-optimized!) and OpenAi to answer questions based on the text found in the database. The database is populated based on URLs from the configuration.\n\n## How to run\n\n- Get an [OpenAI API Key](https://platform.openai.com/account/api-keys)\n- Copy \u0026 paste the API key into the `appsettings.json` or user secrets (`OpenAI:ApiKey`)\n- Optionally adjust the input data in the `appsettings.json` (entry `Urls`)\n- `dotnet run`\n\n## Examples (based on the default content URLs in the sample code) \n\n```\nEnter a question or press enter to quit: What is sk?\n🤖: Semantic Kernel (SK) is a lightweight SDK that lets you easily mix conventional programming languages with the latest in Large Language Model (LLM) AI \"prompts\" with templating, chaining, and planning capabilities out-of-the-box.\n```\n\n```\nEnter a question or press enter to quit: What systems cann SK connect to?\n🤖: SK can connect to external APIs, MS Graph Connector Kit, Bing search query, OpenXML streams, and SQLite.\n```\n\n```\nEnter a question or press enter to quit: Shoe me an example of creating a kernel\n🤖: using Microsoft.SemanticKernel;\n\nvar myKernel = Kernel.Builder.Build();\n```\n\n```\nEnter a question or press enter to quit: Was bedeutet SK?\n🤖: SK steht für Semantic Kernel.\n```\n\n```\nEnter a question or press enter to quit: ¿Qué significa SK?\n🤖: SK significa Kernel Semántico.\n```\n\n## How does it work?\n\n- At the first run, the program will download a couple of pages of the Semantic Kernel documentation (configured in `appsettings.json`).\n- For each page, embeddings will be calculated using the [OpenAI Embeddings model](https://platform.openai.com/docs/guides/embeddings).\n- The content of the page and the embeddings are stored in a sqlite database.\n- When asked a question, embeddings will be calculated for the question.\n- The sqlite database will be searched be similar embeddings.\n- The top 2 results will be concatenated and sent to OpenAI with the following prompts:\n\n```\nUse the following pieces of context to answer the question at the end. If you don't know the answer, don't try to make up an answer and answer with 'I don't know'. Answer in the langauge that used for the question.\n\n{{$context}}\n\nQuestion: {{$input}}\nAnswer:\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinktecture-labs%2Fsemantic-kernel-semanticsearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinktecture-labs%2Fsemantic-kernel-semanticsearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinktecture-labs%2Fsemantic-kernel-semanticsearch/lists"}