Skip to content

Commit

Permalink
Merge pull request #113 from ajdroid/vision_test
Browse files Browse the repository at this point in the history
Vision example update
  • Loading branch information
dongri authored Sep 26, 2024
2 parents b27c0ee + f6b1ddd commit 78abf3a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/vision.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
use openai_api_rs::v1::api::OpenAIClient;
use openai_api_rs::v1::chat_completion::{self, ChatCompletionRequest};
use openai_api_rs::v1::common::GPT4_VISION_PREVIEW;
use openai_api_rs::v1::common::GPT4_O;
use std::env;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = OpenAIClient::new(env::var("OPENAI_API_KEY").unwrap().to_string());

let req = ChatCompletionRequest::new(
GPT4_VISION_PREVIEW.to_string(),
GPT4_O.to_string(),
vec![chat_completion::ChatCompletionMessage {
role: chat_completion::MessageRole::user,
content: chat_completion::Content::ImageUrl(vec![
chat_completion::ImageUrl {
r#type: chat_completion::ContentType::text,
text: Some(String::from("Whats in this image?")),
text: Some(String::from("What's in this image?")),
image_url: None,
},
chat_completion::ImageUrl {
Expand Down

0 comments on commit 78abf3a

Please sign in to comment.