mirror of
https://github.com/mii443/openai-api-rs.git
synced 2025-08-22 15:15:34 +00:00
Add assistant api
This commit is contained in:
@ -1,12 +1,13 @@
|
||||
use openai_api_rs::v1::api::Client;
|
||||
use openai_api_rs::v1::chat_completion::{self, ChatCompletionRequest};
|
||||
use openai_api_rs::v1::common::GPT4;
|
||||
use std::env;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let client = Client::new(env::var("OPENAI_API_KEY").unwrap().to_string());
|
||||
|
||||
let req = ChatCompletionRequest::new(
|
||||
chat_completion::GPT4.to_string(),
|
||||
GPT4.to_string(),
|
||||
vec![chat_completion::ChatCompletionMessage {
|
||||
role: chat_completion::MessageRole::user,
|
||||
content: String::from("What is Bitcoin?"),
|
||||
|
Reference in New Issue
Block a user