Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose async_openai #252

Merged
merged 2 commits into from
Jan 10, 2024
Merged

feat: expose async_openai #252

merged 2 commits into from
Jan 10, 2024

Conversation

katopz
Copy link
Contributor

@katopz katopz commented Jan 2, 2024

I would like to propose exposing async_openai so that I can change the configuration from the outside e.g.

use llm_chain_openai::async_openai::{config::OpenAIConfig, Client};

#[tokio::main(flavor = "current_thread")]
async fn main() {
    let cfg: OpenAIConfig = OpenAIConfig::new()
        .with_api_base("https://openrouter.ai/api/v1")
        .with_api_key("sk-xxx");
    let open_router_ai_client = Client::with_config(cfg);
    let model = "text-embedding-ada-002";

    let embeddings =
        llm_chain_openai::embeddings::Embeddings::for_client(open_router_ai_client, model);
}

FYI: https://openrouter.ai/ is drop in replacement for OpenAI with some free tier that easier to start with.
Not sure we need proper impl for this or just expose async_openai but for present quick win I did choose to expose it first and maybe impl it later if need.

Thanks

@williamhogman williamhogman merged commit a1887dd into sobelio:main Jan 10, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants