Skip to content

Commit

Permalink
docs: fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 30, 2023
1 parent 2d3aa4f commit 049a590
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions enfer_core/src/embedding/semantic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ impl Semantic {
///
/// Example:
/// ```rust
/// use inference_core::Semantic;
/// use inference_core::{init_semantic_with_path, Semantic};
///
/// let semantic = Semantic::new();
/// let embedding = semantic.embed("Hello world!");
/// assert_eq!(embedding.len(), 128); // if the model dimension is 128
///
/// let semantic = init_semantic_with_path("../model/model.onnx", "../model/tokenizer.json").unwrap();
/// let embedding = semantic.embed("Hello world!").unwrap();
/// ```
pub fn embed(&self, sequence: &str) -> Result<Embedding, SemanticError> {
let encoding = self.tokenizer.encode(sequence, true)
Expand Down
8 changes: 4 additions & 4 deletions enfer_core/src/store/memory_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ pub struct InMemoryEmbeddingStore {
///
/// Example:
/// ```rust
/// use inference_core::{Document, InMemoryEmbeddingStore, Semantic};
/// use inference_core::{Document, init_semantic_with_path, InMemoryEmbeddingStore, Semantic};
///
/// let semantic = Semantic::new();
/// let semantic = init_semantic_with_path("../model/model.onnx", "../model/tokenizer.json").unwrap();
/// let store = InMemoryEmbeddingStore::new();
///
/// let embedding = semantic.embed("Hello world!");
/// let id = store.add("".to_string(), embedding, Document::from("Hello world!".to_string()));
/// let embedding = semantic.embed("Hello world!").unwrap();
/// let id = store.add("".to_string(), embedding.clone(), Document::from("Hello world!".to_string()));
/// let matches = store.find_relevant(embedding, 10, 0.0);
/// assert_eq!(matches.len(), 1);
/// ```
Expand Down

0 comments on commit 049a590

Please sign in to comment.