Copilot
Overview
Copilot Rust SDK is a Rust library for interacting with the chat model. It provides integration with the chat API, support for custom function tools, and message handling.
Features
- Chat model integration: Interact with the chat API through the
ChatModelstructure. - Custom function tool: Implement custom function tools using
FunctionToolandFunctiomImplTrait. - Macro support: Simplify function tool injection and configuration using
completemacro.
Installation
Add the following dependencies to your Cargo.toml:
= "0.1.2"
Usage
Chat model integration
To interact with the chat model, you need to create a ChatModel instance with the necessary configuration.
normally, you can use the ChatModel::builder() method to create a ChatModel instance.
or you can use serde to deserialize a ChatModel instance from a JSON string.
then use complete macro to inject paramaters and function tools into the chat function.
Custom function tool
You can define your own function tool by implementing the FunctionTool and FunctiomImplTrait traits.
also, you need implement serde's Deserialize and Serialize traits. beacuse copilot-rs will use serde to deserialize the function tool from a JSON string.
more detail, please see the example in the src/main.rs file.
TODO
- Structure output
- More examples
- Agent
- SSE support
Notice
This project is still in the early stages of development. It is not yet ready for production use. if you have some issues with it, please feel free to open an issue or submit a pull request.