diff --git a/README.md b/README.md index 4b6d184..604b971 100644 --- a/README.md +++ b/README.md @@ -300,9 +300,11 @@ const App = () => { ### Embedding -Convert text into numerical vector representations that capture semantic meaning, useful for similarity search and semantic understanding. +Convert text and images into numerical vector representations that capture semantic meaning, useful for similarity search and semantic understanding. -#### Class +#### Text Embedding + +##### Class ```typescript import { CactusLM } from 'cactus-react-native'; @@ -314,7 +316,7 @@ console.log('Embedding vector:', result.embedding); console.log('Embedding vector length:', result.embedding.length); ``` -#### Hook +##### Hook ```tsx import { useCactusLM } from 'cactus-react-native'; @@ -332,6 +334,38 @@ const App = () => { }; ``` +#### Image Embedding + +##### Class + +```typescript +import { CactusLM } from 'cactus-react-native'; + +const cactusLM = new CactusLM({ model: 'lfm2-vl-450m' }); + +const result = await cactusLM.imageEmbed({ imagePath: 'path/to/your/image.jpg' }); +console.log('Image embedding vector:', result.embedding); +console.log('Embedding vector length:', result.embedding.length); +``` + +##### Hook + +```tsx +import { useCactusLM } from 'cactus-react-native'; + +const App = () => { + const cactusLM = useCactusLM({ model: 'lfm2-vl-450m' }); + + const handleImageEmbed = async () => { + const result = await cactusLM.imageEmbed({ imagePath: 'path/to/your/image.jpg' }); + console.log('Image embedding vector:', result.embedding); + console.log('Embedding vector length:', result.embedding.length); + }; + + return