Skip to content

Commit 2efef24

Browse files
committed
Improving naming [skip ci]
1 parent a3e55e2 commit 2efef24

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Examples/Ollama/Sources/main.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ let config = PostgresClient.Configuration(
1313

1414
let client = PostgresClient(configuration: config)
1515

16-
func generateEmbedding(input: String) async throws -> [Double] {
16+
func embed(input: String) async throws -> [Double] {
1717
let response = try await Client.default.embed(
1818
model: "nomic-embed-text",
1919
input: input
@@ -37,12 +37,12 @@ try await withThrowingTaskGroup(of: Void.self) { taskGroup in
3737
]
3838

3939
for content in input {
40-
let embedding = try await generateEmbedding(input: content)
40+
let embedding = try await embed(input: content)
4141
try await client.query("INSERT INTO documents (content, embedding) VALUES (\(content), \(embedding))")
4242
}
4343

4444
let query = "forest"
45-
let embedding = try await generateEmbedding(input: query)
45+
let embedding = try await embed(input: query)
4646
let rows = try await client.query("SELECT content FROM documents ORDER BY embedding <=> \(embedding)::vector LIMIT 5")
4747
for try await row in rows {
4848
print(row)

0 commit comments

Comments
 (0)