Skip to content

Commit

Permalink
reiintroduce test (#3193)
Browse files Browse the repository at this point in the history
  • Loading branch information
spolu authored Jan 13, 2024
1 parent 9b78ef1 commit 7baa221
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions core/src/data_sources/splitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -956,40 +956,40 @@ mod tests {
)
}

// #[tokio::test]
// async fn test_splitter_bug_20240111() {
// // Splitting issue with a section with no prefix but with content and childrens.
// let section = Section {
// prefix: Some("Ok a prefix\n".to_string()),
// content: None,
// sections: vec![Section {
// prefix: None,
// content: Some(
// "Then a section with no prefix, but content and children".to_string(),
// ),
// sections: vec![
// Section {
// prefix: Some("Prefix1".to_string()),
// content: Some("Text1".to_string()),
// sections: vec![],
// },
// Section {
// prefix: Some("Prefix2".to_string()),
// content: Some("Text2".to_string()),
// sections: vec![],
// },
// ],
// }],
// };

// let provider_id = ProviderID::OpenAI;
// let model_id = "text-embedding-ada-002";
// let credentials = Credentials::from([("OPENAI_API_KEY".to_string(), "abc".to_string())]);

// // Before the fix, this would fail (assertion failure in TokenizedSection.chunk).
// splitter(SplitterID::BaseV0)
// .split(credentials, provider_id, model_id, 256, section)
// .await
// .unwrap();
// }
#[tokio::test]
async fn test_splitter_bug_20240111() {
// Splitting issue with a section with no prefix but with content and childrens.
let section = Section {
prefix: Some("Ok a prefix\n".to_string()),
content: None,
sections: vec![Section {
prefix: None,
content: Some(
"Then a section with no prefix, but content and children".to_string(),
),
sections: vec![
Section {
prefix: Some("Prefix1".to_string()),
content: Some("Text1".to_string()),
sections: vec![],
},
Section {
prefix: Some("Prefix2".to_string()),
content: Some("Text2".to_string()),
sections: vec![],
},
],
}],
};

let provider_id = ProviderID::OpenAI;
let model_id = "text-embedding-ada-002";
let credentials = Credentials::from([("OPENAI_API_KEY".to_string(), "abc".to_string())]);

// Before the fix, this would fail (assertion failure in TokenizedSection.chunk).
splitter(SplitterID::BaseV0)
.split(credentials, provider_id, model_id, 256, section)
.await
.unwrap();
}
}

0 comments on commit 7baa221

Please sign in to comment.