Skip to content

Commit

Permalink
*Actually* don't fail if .env fails to load
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinegb committed Jan 15, 2023
1 parent 4097e24 commit 796e959
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/embeddings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ mod tests {

#[tokio::test]
async fn embeddings() {
dotenv().unwrap(); // If it fails, assume we're not using a .env file
#![allow(unused_must_use)]
dotenv();

let embeddings = Embeddings::new(
ModelID::TextEmbeddingAda002,
Expand All @@ -88,7 +89,8 @@ mod tests {

#[tokio::test]
async fn embedding() {
dotenv().unwrap(); // If it fails, assume we're not using a .env file
#![allow(unused_must_use)]
dotenv();

let embedding = Embedding::new(
ModelID::TextEmbeddingAda002,
Expand Down
6 changes: 4 additions & 2 deletions src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ mod tests {

#[tokio::test]
async fn can_get_model() {
dotenv().unwrap(); // If it fails, assume we're not using a .env file
#![allow(unused_must_use)]
dotenv();

let model = Model::new(ModelID::TextDavinci003).await
.expect("should return model");
Expand All @@ -341,7 +342,8 @@ mod tests {

#[tokio::test]
async fn can_get_custom_model() {
dotenv().unwrap(); // If it fails, assume we're not using a .env file
#![allow(unused_must_use)]
dotenv();

let model = Model::new(
ModelID::Custom("davinci:ft-personal-2022-12-12-04-49-51".to_string())
Expand Down

0 comments on commit 796e959

Please sign in to comment.