Imagine.NET 0.1.0

dotnet add package Imagine.NET --version 0.1.0
                    
NuGet\Install-Package Imagine.NET -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Imagine.NET" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Imagine.NET" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Imagine.NET" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Imagine.NET --version 0.1.0
                    
#r "nuget: Imagine.NET, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Imagine.NET@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Imagine.NET&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Imagine.NET&version=0.1.0
                    
Install as a Cake Tool

Introduction

Imagine.NET is a .NET Core library that emulates an 'imaginary database' that allows you to query GPT with fluent LINQ to generate and transform data. It works seamlessly with .NET types and data structures to take full advantage of GPT's excellent zero-shot semantic understanding and completion, enabling simple but powerful data processing paradigms.

Why?

Most software works with structured data and predefined types at compile-time. However, it can be challenging to get such structured data in and out of GPT prompt chains. Imagine.NET lets you focus on describing your domain model in a fluent and declarative manner that is both familiar and productive. This project is used to power the 'imagination' and reasoning of AI agents like Cheevly.

Overview

Imagine.NET offers two types of processing pipelines.

Type + Prompt

Provide a .NET Type and a text prompt to get back a list of data that conforms to the prompt.

List + Type + Prompt

Provide a list of input data, a .NET Type and a text prompt and get back a new list of data derived from the list and prompt.

Diagram

Getting started

Generate a list of 5 people whose first name start with 'b' and last name starts with 'd'
var imagination = new Imagination("GPT API KEY");
var results = imagination.Imagine<Person>(count: 5).Where(person => person.FirstName.StartsWith("b") && person.LastName.StartsWith("d")).ToList();

public class Person {
    public string FirstName;
    public string LastName;
    public int Age;
}
Simulate a text conversation between a mother and child
var imagination = new Imagination("GPT API KEY");
var messages = imagination.Imagine<SMSMessage>("conversation between mother and child", 5).ToList();

public class SMSMessage {
    public Person Sender;
    public Person Recipient;
    public string Text;
}

public class Person {
    public string FirstName;
    public string LastName;
    public int Age;
}

Messages

Generate character abilities and then simulate a battle
var imagination = new Imagination("GPT API KEY");

var combatant1 = new Combatant { Name = "Josh", Description = "A master of canine magic" };
var combatant2 = new Combatant { Name = "Mack", Description = "A master of feline magic" };

// Lets imagine 5 abilities for combatant1
combatant1.Abilities = imagination.Imagine<Ability>(combatant1, count: 5).ToList();

// Now imagine 5 abilities for combatant2
combatant2.Abilities = imagination.Imagine<Ability>(combatant2, count: 5).ToList();

var combatants = new List<Combatant> { combatant1, combatant2 };

// Simulate 10 rounds of combat in the snow
var rounds = imagination.Imagine<CombatRound>(combatants, "snow", count: 10).ToList();
            
public class Combatant {
  public string Name;
  public string Description;
  public List<Ability> Abilities;
}

public class Ability {
  public string Name;
  public string Description;
}

public class CombatRound {
  public string Description;
}
Combatant 1 Combatant 2
Abilities Abilities

Use cases

  • Procedural content generation
  • Data analysis
  • Semantic reasoning
  • ETL (extract-transform-load)
  • Unit test data generation
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 2,420 3/13/2023