Pieces OS Client SDK For C
February 28, 2025 ยท View on GitHub
Pieces OS Client SDK For C#
Introduction
The Pieces OS Client SDK is a set of powerful code engine packages designed for writing applications on top of Pieces OS. It facilitates communication with a locally hosted server to enable features such as copilot chats, asset saving, and more.
This SDK has 2 packages:
- Pieces.OS.Client - this is the core SDK package providing access to the features of Pieces from your C# application
- Pieces.Extensions.AI - this is an implementation of Microsoft.Extensions.AI using Pieces to provide support for multiple LLMs, as well as adding context such as snippets, files, folders, and Pieces Long-Term Memory to your AI conversation.
Features
The Pieces SDK offers the following key features:
- Copilot Chats: Communicate seamlessly with copilot chats functionality.
- Asset Management: Save and manage assets and formats efficiently.
- Local Server Interaction: Interact with a locally hosted server for various functionality.
- Multi-LLM support: Use any Pieces supported LLM to power your app.
- File, folder, and Pieces Long-Term Memory in copilot chats
Installation
To get started with the Pieces OS Client SDK, follow these steps:
-
Download Pieces OS: Pieces OS serves as the primary backend service, providing essential functionality for the SDK. Download the appropriate version for your operating system:
-
Install the SDK: Use nuget to install the Pieces OS Client SDK package:
dotnet add package Pieces.OS.Client --prerelease -
Install the Extensions SDK: If you want Microsoft.Extensions.AI support, install the Pieces.Extensions.AI package:
dotnet add package Pieces.Extensions.AI --prerelease
Projects
This repo contains the following projects:
- Pieces.OS.Client - the OS client SDK
- Pieces.Extensions.AI - support for Microsoft.Extensions.AI
- Pieces.OS.Core - an internal library wrapping the Pieces OS API
- Pieces.OS.Client.Example - example code for using the Pieces.OS.Client SDK
- Pieces.Extensions.AI.Example - example code for using the Pieces.Extensions.AI SDK
- SampleApps - a selection of sample apps
Sample apps
- Remind Me - an app that reminds you about what you have been working on over the last few hours using Pieces Long-Term Memory.
Pieces.OS.Client Examples
There is an example project using the Pieces.OS.Client package in the ./src/Client.Example folder. This example is a console app containing a range of different examples, each commented out. To run these examples, uncomment the one you want to run, then run dotnet run from the ./src/Client.Example folder.
Details of this example project are provided in the src/Client/README.md file.
Pieces.Extensions.AI Examples
There is an example project using the Pieces.Extensions.AI package in the ./src/Extensions.Example folder. This example is a console app containing a range of different examples, each commented out. To run these examples, uncomment the one you want to run, then run dotnet run from the ./src/Extensions.Example folder.
Details of this example project are provided in the src/Extensions/README.md file.
Publish the packages
This repo includes GitHub actions to publish both the Pieces.OS.Client and Pieces.Extensions.AI packages.
The Pieces.Extensions.AI package is dependent on the Pieces.OS.Client package. The way this is implemented is:
- In this repo, the Pieces.Extensions.AI project has a project dependency on Pieces.OS.Client and Pieces.OS.Core
- In the action to publish, this project dependency is removed, and a nuget package dependency is added to the latest pre-release Pieces.OS.Core.
To publish these packages, do the following:
- Tag this repo using a tag of
client-v<x.y.z-a>where<x.y.z-a>is the version string. For example, to release0.0.10-betayou would tag withclient-v0.0.10-beta. This will only build and publish the Pieces.OS.Client package. - Once the Pieces.OS.Client package has been validated and made public on nuget, tag the repo using a tag of
extensions-v<x.y.z-a>, for exampleextensions-v0.0.10-beta. This will build the Pieces.Extensions.AI package using the nuget package reference to Pieces.OS.Client, and publish to nuget.
