Crates.io | evilcorp_secondpilot |
lib.rs | evilcorp_secondpilot |
version | 2.3.0 |
source | src |
created_at | 2023-05-25 17:35:14.271953 |
updated_at | 2023-07-06 02:39:45.804229 |
description | A wrapper to the EvilCorp SecondPilot API |
homepage | |
repository | https://github.com/19h/evilcorp_secondpilot |
max_upload_size | |
id | 874446 |
size | 44,456 |
A wrapper to the EvilCorp SecondPilot API, allowing developers to utilize its powerful auto-completion and code generation capabilities in their own applications. This client uses the futures-util
, reqwest
, and serde
crates, among others.
Add this to your Cargo.toml
:
[dependencies]
evilcorp_secondpilot = "^2.0.0"
Then, import the library and use the EvilcorpSecondPilotClient
struct as follows:
use evilcorp_secondpilot::{
CompletionRequestBuilder,
EvilcorpSecondPilotClient,
Message,
};
let client =
EvilcorpSecondPilotClient::new(
"<your token>",
);
let message = Message {
content: "your message".to_string(),
role: "user".to_string(),
};
let request = CompletionRequestBuilder::new()
.with_model("<model>")
.with_temperature(<temperature>)
.with_top_p(<top_p>)
.add_message(message)
.build()
.await;
let response = client.query(&request).await?;
println!("Response: {}", response);
TokenResponse
is a helper struct that wraps the response from the token endpoint of the API.CompletionRequest
is a helper struct that wraps a request to the completions endpoint.Message
is a helper struct that wraps a message to be included in a CompletionRequest
.CompletionRequestBuilder
is a struct to help build CompletionRequest
objects.CompletionResponse
, Choice
, and Delta
are helper structs that wrap responses from the completions endpoint.EvilcorpSecondPilotClient
is the main struct that communicates with the EvilCorp SecondPilot API.This project is licensed under the MIT License.
Please note that this project is in no way affiliated with, authorized, maintained, sponsored or endorsed by EvilCorp or any of its affiliates or subsidiaries. This is an independent and unofficial API wrapper.