This commit is contained in:
17
docs/snippets/kotlin/utils/standalone_embed.md
Normal file
17
docs/snippets/kotlin/utils/standalone_embed.md
Normal file
@@ -0,0 +1,17 @@
|
||||
```kotlin title="Kotlin"
|
||||
import dev.kreuzberg.*
|
||||
import java.util.Optional
|
||||
|
||||
fun main() {
|
||||
val config = EmbeddingConfig.builder()
|
||||
.withModel(EmbeddingModelType.Preset("balanced"))
|
||||
.withNormalize(true)
|
||||
.build()
|
||||
|
||||
val texts = listOf("Hello, world!", "Kreuzberg is fast")
|
||||
val embeddings = Kreuzberg.embedTexts(texts, config)
|
||||
|
||||
println("Texts embedded: ${embeddings.size}")
|
||||
println("Dimensions: ${embeddings[0].size}")
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user