Add assistant api

This commit is contained in:
Dongri Jin
2023-11-11 18:24:51 +09:00
parent 6e07047c27
commit cfca665c21
19 changed files with 966 additions and 48 deletions

View File

@ -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?"),