asimov-server 25.1.0

ASIMOV Software Development Kit (SDK) for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
// This is free and unencumbered software released into the public domain.

use bs58;
use uuid::Uuid;

/// Generate an OpenAI-style identifier with the given prefix.
pub fn generate_openai_id(prefix: &str) -> String {
    let uuid = Uuid::new_v4();
    let uuid_bytes = uuid.as_bytes();
    let encoded = bs58::encode(uuid_bytes).into_string();
    format!("{}-{}", prefix, encoded)
}