This commit is contained in:
26
docs/snippets/ruby/metadata/vector_database_integration.md
Normal file
26
docs/snippets/ruby/metadata/vector_database_integration.md
Normal file
@@ -0,0 +1,26 @@
|
||||
```ruby title="Ruby"
|
||||
require 'kreuzberg'
|
||||
|
||||
config = Kreuzberg::ExtractionConfig.new(
|
||||
chunking: Kreuzberg::ChunkingConfig.new(
|
||||
max_characters: 512,
|
||||
overlap: 50,
|
||||
embedding: Kreuzberg::EmbeddingConfig.new(
|
||||
model: Kreuzberg::EmbeddingModelType.new(
|
||||
type: 'preset',
|
||||
name: 'balanced'
|
||||
),
|
||||
normalize: true
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
result = Kreuzberg.extract_file_sync('document.pdf', config: config)
|
||||
|
||||
result.chunks.each_with_index do |chunk, i|
|
||||
if chunk.embedding
|
||||
puts "Chunk #{i}: #{chunk.embedding.length} dimensions"
|
||||
# Store in vector database
|
||||
end
|
||||
end
|
||||
```
|
||||
Reference in New Issue
Block a user