Skip to main content

Crate vibesort_rs

Crate vibesort_rs 

Source
Expand description

§Vibesort

A Rust library for sorting arrays using Large Language Models (LLMs).

This library provides a simple interface to sort arrays by leveraging LLM APIs such as OpenAI, Anthropic, or other compatible services. It sends the array to the LLM and parses the sorted result.

§Features

  • Sort arrays of any type that implements Display, Serialize, and DeserializeOwned
  • Support for any LLM API compatible with OpenAI’s chat completion format
  • Comprehensive error handling with detailed error messages
  • Async/await support using Tokio

§Example

use vibesort_rs::Vibesort;

let sorter = Vibesort::new(
    "your-api-key",
    "gpt-3.5-turbo",
    "https://api.openai.com/v1",
);

let numbers = vec![3, 1, 4, 1, 5, 9, 2, 6];
let sorted = sorter.sort(&numbers).await?;
println!("{:?}", sorted); // [1, 1, 2, 3, 4, 5, 6, 9]

Structs§

Vibesort
Client for sorting arrays using LLM APIs.

Enums§

VibesortError
Error types for vibesort operations.