{"id":20980109,"url":"https://github.com/mehrandvd/semanticvalidation","last_synced_at":"2025-05-14T15:30:29.798Z","repository":{"id":213767021,"uuid":"734881879","full_name":"mehrandvd/SemanticValidation","owner":"mehrandvd","description":"SemanticValidation is a library that integrates OpenAI’s powerful language models with validation systems. It allows you to perform semantic checks on your data and queries using natural language understanding.","archived":false,"fork":false,"pushed_at":"2025-05-07T15:31:10.000Z","size":44,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-07T16:45:42.424Z","etag":null,"topics":["azure-openai","csharp","dotnet","open-ai","openai","semantic-kernel","similarity","validation"],"latest_commit_sha":null,"homepage":"","language":"C#","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/mehrandvd.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,"zenodo":null}},"created_at":"2023-12-22T22:39:43.000Z","updated_at":"2025-05-07T15:30:41.000Z","dependencies_parsed_at":"2023-12-22T23:28:15.264Z","dependency_job_id":"497f141a-3866-46c4-b499-e0822a1930d9","html_url":"https://github.com/mehrandvd/SemanticValidation","commit_stats":{"total_commits":29,"total_committers":2,"mean_commits":14.5,"dds":0.4482758620689655,"last_synced_commit":"ee93a170dc77a53b28cf59b806b55e9db2d972c0"},"previous_names":["mehrandvd/semanticvalidation"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehrandvd%2FSemanticValidation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehrandvd%2FSemanticValidation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehrandvd%2FSemanticValidation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mehrandvd%2FSemanticValidation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mehrandvd","download_url":"https://codeload.github.com/mehrandvd/SemanticValidation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254171518,"owners_count":22026456,"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":["azure-openai","csharp","dotnet","open-ai","openai","semantic-kernel","similarity","validation"],"created_at":"2024-11-19T05:16:30.355Z","updated_at":"2025-05-14T15:30:29.775Z","avatar_url":"https://github.com/mehrandvd.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Semantic Validation\n[![Build and Deploy](https://github.com/mehrandvd/SemanticValidation/actions/workflows/build.yml/badge.svg)](https://github.com/mehrandvd/SemanticValidation/actions/workflows/build.yml)\n[![NuGet version (SemanticValidation)](https://img.shields.io/nuget/v/SemanticValidation.svg?style=flat)](https://www.nuget.org/packages/SemanticValidation/)\n[![NuGet downloads](https://img.shields.io/nuget/dt/SemanticValidation.svg?style=flat)](https://www.nuget.org/packages/SemanticValidation)\n\nSemanticValidation is a library that integrates OpenAI’s powerful language models with validation systems. It allows you to perform semantic checks on your data and queries using natural language understanding.\n\nIt **brings the power of OpenAI into the validation systems** as easily as this:\n```csharp\nvar result = Semantic.AreSimilar(\"This automobile is red\", \"The car is red\");\n\nConsole.WriteLine(result.IsValid);\n// true\n```\nThe interesting part is that: **When it fails, it explains why!** (thanks to OpenAI)\n```csharp\nvar result = Semantic.AreSimilar(\"This bicycle is red\", \"The car is red\");\n\nConsole.WriteLine(result.IsValid);\n// false\n\nConsole.WriteLine(result.Reason);\n// The first text describes a red bicycle, while the second text describes a red car. They are not semantically equivalent.\n```\nUnder the hood, it uses OpenAI and [SemanticKernel](https://github.com/microsoft/semantic-kernel/) to do all the semantic stuff.\n\nThere are other semantic methods available too. The `HasConditoin` checks if a `text` meets a special `condition`. And again watch how \ngreat it describes the reason for semantic validation failure.\n```csharp\nvar result = Semantic.HasCondition(\n                text: \"This car is red\",\n                condition: \"It talks about trees\"\n\nConsole.WriteLine(result.IsValid);\n// false\n\nConsole.WriteLine(result.Reason);\n// The input text does not talk about trees\n```\n\n## Features\n- **Brings the power of OpenAI into the validation systems**: You can use OpenAI's language models to perform semantic validation on your data and queries with a simple and intuitive syntax.\n- **Provides explanatory feedback**: When a semantic check fails, it explains why, thanks to OpenAI's natural language generation capabilities.\n- **Uses OpenAI and SemanticKernel under the hood**: Semantic Validation relies on OpenAI and SemanticKernel to do all the semantic stuff. SemanticKernel is a library that provides a unified interface to interact with OpenAI's language models.\n\n## Requirements\n- .NET 8.0 or higher\n- An OpenAI API key\n\n\n## Installation\nSemantic Validation is available as a [NuGet](https://www.nuget.org/packages/SemanticValidation) package that you can easily install in your project. To do so, run the following command in your terminal:\n```bash\ndotnet add package SemanticValidation\n```\n\nNext, you need to create an instance of the `Semantic` class and pass a `IChatClient` to it:\n```csharp\nvar chatClient = new AzureOpenAIClient\n  (\n    new Uri(endpoint),\n    new System.ClientModel.ApiKeyCredential(apiKey)\n  )\n  .AsChatClient(deploymentName);\n\nvar semantic = new Semantic(chatClient);\n```\nThat's it! You are ready to use Semantic Validation in your code. 😊\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmehrandvd%2Fsemanticvalidation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmehrandvd%2Fsemanticvalidation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmehrandvd%2Fsemanticvalidation/lists"}