whis-core 0.5.7

Core library for whis voice-to-text functionality
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use anyhow::{Context, Result};
use std::env;

pub struct ApiConfig {
    pub openai_api_key: String,
}

impl ApiConfig {
    pub fn from_env() -> Result<Self> {
        dotenvy::dotenv().ok(); // Load .env file if it exists

        let openai_api_key = env::var("OPENAI_API_KEY")
            .context("OPENAI_API_KEY not found. Please set it in .env file or environment")?;

        Ok(ApiConfig { openai_api_key })
    }
}