CrossIntelligence

CrossIntelligence

Provides unified access to Apple Intelligence and external LLMS for MAUI and .NET apps

Stars: 67

Visit
 screenshot

CrossIntelligence is a powerful tool for data analysis and visualization. It allows users to easily connect and analyze data from multiple sources, providing valuable insights and trends. With a user-friendly interface and customizable features, CrossIntelligence is suitable for both beginners and advanced users in various industries such as marketing, finance, and research.

README:

CrossIntelligence

Build NuGet Version

A library to provide access to Apple Intelligence and other LLMs for .NET and MAUI applications.

Installation

You can install the CrossIntelligence library via NuGet:

dotnet add package CrossIntelligence

Usage

To use the CrossIntelligence library, you need to create an instance of the IntelligenceSession class and call its methods.

using CrossIntelligence;

var session = new IntelligenceSession();
var response = await session.RespondAsync("What is the meaning of life?");
Console.WriteLine(response);

Features

  • [x] Access to Apple Intelligence System Language Model
  • [x] Access to OpenAI Models
  • [x] Prompt text input
  • [x] Text output
  • [x] System instructions
  • [x] Chat functionality (session history)
  • [x] Tool/function support
  • [x] Structured output

Structured Output

You can define a structured output by creating a class with properties that match the expected output format. The library will automatically deserialize the response into your class.

class NonPlayerCharacter
{
    public required string Name { get; set; }
    public required int Age { get; set; }
    public required string Occupation { get; set; }
}

var session = new IntelligenceSession();
var response = await session.RespondAsync<NonPlayerCharacter>("Generate a random NPC with a name, age, and occupation.");
Console.WriteLine($"Name: {response.Name}, Age: {response.Age}, Occupation: {response.Occupation}");

Tools (Functions)

You can define tools (functions) that the LLM can call to perform specific tasks. Define a class the inherits from IntelligenceTool and implement the ExecuteAsync method. Tools take arguments that are specified using a generic type parameter.

class AddPlayerTool : IntelligenceTool<NonPlayerCharacter>
{
    private GameDatabase gameDatabase;
    public AddPlayerTool(GameDatabase gameDatabase)
    {
        this.gameDatabase = gameDatabase;
    }
    public override string Name => "AddPlayer";
    public override string Description => "Adds a new non-player character (NPC) to the game.";
    public override async Task<string> ExecuteAsync(NonPlayerCharacter npc)
    {
        await gameDatabase.AddPlayerAsync(npc);
        return $"Added NPC: {npc.Name}.";
    }
}

var gameDatabase = new GameDatabase();
var session = new IntelligenceSession(tools: [new AddPlayerTool(gameDatabase)]);
var response = await session.RespondAsync("Add 3 new NPCs to the game.");
Console.WriteLine(response);

Calling External Models

You can use other models than the default system model by passing in the model parameter when creating the IntelligenceSession.

var session = new IntelligenceSession(model: IntelligenceModel.OpenAI("gpt-4.1", apiKey: "OPENAI_API_KEY"));
var response = await session.RespondAsync("What is the meaning of life?");
Console.WriteLine(response);

Contributing

If you'd like to contribute to the CrossIntelligence library, please fork the repository and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

For Tasks:

Click tags to check more tools for each tasks

For Jobs:

Alternative AI tools for CrossIntelligence

Similar Open Source Tools

For similar tasks

For similar jobs