Git Product home page Git Product logo

smartcomponents's Introduction

Smart Components

Smart Components lets you add genuinely useful AI-powered features to your .NET apps quickly, easily, and without risking wasted effort.

You don't have to spend weeks of dev time redesigning your UX or researching machine learning and prompt engineering. Smart Components are prebuilt end-to-end AI features that you can drop into your existing UIs to upgrade them, truly making your app more productive for your end users.

This is an experiment from the .NET team, and is initially available for ASP.NET Core 6.0 and later with either:

We may add support for other UI tech (e.g., native apps) later, depending on feedback.

What's included

The set of components and features may expand over time. Currently, Smart Components includes:

Smart Paste

A button that fills out forms automatically using data from the user's clipboard. You can use this with any existing form in your web app. This helps users add data from external sources without re-typing.

Screen capture of Smart Paste feature

Learn more: Smart Paste docs

Smart TextArea

An intelligent upgrade to the traditional textarea. You can configure how it should autocomplete whole sentences using your own preferred tone, policies, URLs, and so on. This helps users type faster and not have to remember URLs etc.

Screen capture of Smart TextArea feature

Learn more: Smart TextArea docs

Smart ComboBox

Upgrades the traditional combobox by making suggestions based on semantic matching. This helps users find what they're looking for.

Screen capture of Smart ComboBox feature

Learn more: Smart ComboBox docs

Local Embeddings

Computes the level of semantic similarity between two natural language strings, or finds the closest match from a set of candidates. This runs entirely locally on your server's CPU, so doesn't need any external AI service.

Example: evaluating the semantic similarity between two strings

var article1 = embedder.Embed("Vacation allowance policy");
var article2 = embedder.Embed("Returning a company vehicle");
var article3 = embedder.Embed("How to get your boss fired");

var searchTerm = embedder.Embed("car");
Console.WriteLine(searchTerm.Similarity(article1)); // Outputs: 0.41
Console.WriteLine(searchTerm.Similarity(article2)); // Outputs: 0.70
Console.WriteLine(searchTerm.Similarity(article3)); // Outputs: 0.38

Example: finding closest matches

// Find closest matches to "ball game"
var candidates = embedder.EmbedRange(["Soccer", "Tennis", "Swimming", "Horse riding", "Golf", "Gymnastics"]);

var closest = LocalEmbedder.FindClosest(
    embedder.Embed("ball game"), candidates, maxResults: 3);

Console.WriteLine(string.Join(", ", closest)); // "Soccer, Golf, Tennis"

Unlike the others, this isn't a prebuilt end-to-end UI feature; it's a general capability you can use to power your own features, such as search or retrieval-augmented generation (RAG).

Learn more: Local Embeddings docs

Running the samples

  1. If you don't already have it, install a current .NET SDK for Windows, Linux, or Mac.

  2. Clone this repo

    git clone https://github.com/dotnet-smartcomponents/smartcomponents.git
    cd smartcomponents
    
  3. If you want to run the Smart Paste or Smart TextArea samples, edit the RepoSharedConfig.json file at the root of the solution to add your API key. See How to configure an OpenAI backend.

    You can skip this if you only want to run the Smart ComboBox or Local Embeddings samples, since they run entirely locally.

  4. Run it

    cd samples/ExampleBlazorApp
    dotnet run
    

Once you're ready to add Smart Components to your own app, see:

Feedback and support

The purpose of this experiment is to assess whether/how the .NET community would want to use prebuilt UI components for AI features.

Please give us your feedback, even if it's just to say "Yes I want this" or "I won't use this because...". To give feedback, post an issue here.

Smart Components isn't yet an officially supported part of .NET. Whether or not it graduates to full support depends on community feedback and usage levels.

Contributing

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

smartcomponents's People

Contributors

stevesandersonms avatar microsoftopensource avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.