Skip to content

Commit

Permalink
Renamed methods to be guideline compliant
Browse files Browse the repository at this point in the history
  • Loading branch information
jpalvarezl committed Sep 18, 2024
1 parent ea52edd commit 83510b9
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion sdk/openai/inference/examples/azure_chat_completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub async fn main() -> Result<()> {
std::env::var("AZURE_OPENAI_ENDPOINT").expect("Set AZURE_OPENAI_ENDPOINT env variable");
let secret = std::env::var("AZURE_OPENAI_KEY").expect("Set AZURE_OPENAI_KEY env variable");

let chat_completions_client = AzureOpenAIClient::with_key(
let chat_completions_client = AzureOpenAIClient::with_key_credential(
endpoint,
secret,
Some(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async fn main() -> Result<()> {
std::env::var("AZURE_OPENAI_ENDPOINT").expect("Set AZURE_OPENAI_ENDPOINT env variable");
let secret = std::env::var("AZURE_OPENAI_KEY").expect("Set AZURE_OPENAI_KEY env variable");

let chat_completions_client = AzureOpenAIClient::with_key(
let chat_completions_client = AzureOpenAIClient::with_key_credential(
endpoint,
secret,
Some(
Expand Down
3 changes: 2 additions & 1 deletion sdk/openai/inference/examples/chat_completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ use azure_openai_inference::{
pub async fn main() -> azure_core::Result<()> {
let secret = std::env::var("OPENAI_KEY").expect("Set OPENAI_KEY env variable");

let chat_completions_client = OpenAIClient::with_key(secret, None)?.chat_completions_client();
let chat_completions_client =
OpenAIClient::with_key_credential(secret, None)?.chat_completions_client();

let chat_completions_request = CreateChatCompletionsRequest::new_with_user_message(
"gpt-3.5-turbo-1106",
Expand Down
3 changes: 2 additions & 1 deletion sdk/openai/inference/examples/chat_completions_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use std::io::{self, Write};
async fn main() -> Result<()> {
let secret = std::env::var("OPENAI_KEY").expect("Set OPENAI_KEY env variable");

let chat_completions_client = OpenAIClient::with_key(secret, None)?.chat_completions_client();
let chat_completions_client =
OpenAIClient::with_key_credential(secret, None)?.chat_completions_client();

let chat_completions_request = CreateChatCompletionsRequest::new_stream_with_user_message(
"gpt-3.5-turbo-1106",
Expand Down
4 changes: 2 additions & 2 deletions sdk/openai/inference/src/clients/azure_openai_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub trait AzureOpenAIClientMethods: BaseOpenAIClientMethods {
where
Self: Sized;

fn with_key(
fn with_key_credential(
endpoint: impl AsRef<str>,
secret: impl Into<String>,
client_options: Option<AzureOpenAIClientOptions>,
Expand Down Expand Up @@ -63,7 +63,7 @@ impl AzureOpenAIClientMethods for AzureOpenAIClient {
})
}

fn with_key(
fn with_key_credential(
endpoint: impl AsRef<str>,
secret: impl Into<String>,
client_options: Option<AzureOpenAIClientOptions>,
Expand Down
4 changes: 2 additions & 2 deletions sdk/openai/inference/src/clients/openai_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{auth::OpenAIKeyCredential, OpenAIClientOptions};
use super::{BaseOpenAIClientMethods, ChatCompletionsClient};

pub trait OpenAIClientMethods {
fn with_key(
fn with_key_credential(
secret: impl Into<String>,
client_options: Option<OpenAIClientOptions>,
) -> Result<Self>
Expand All @@ -26,7 +26,7 @@ pub struct OpenAIClient {
}

impl OpenAIClientMethods for OpenAIClient {
fn with_key(
fn with_key_credential(
secret: impl Into<String>,
client_options: Option<OpenAIClientOptions>,
) -> Result<Self> {
Expand Down

0 comments on commit 83510b9

Please sign in to comment.