cosineDistance() — drizzle-orm Function Reference
Architecture documentation for the cosineDistance() function in vector.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 52f00476_8bee_baa2_0078_c831b1bd4433["cosineDistance()"] d155802d_6bf7_144f_94a8_70b957517dac["vector.ts"] 52f00476_8bee_baa2_0078_c831b1bd4433 -->|defined in| d155802d_6bf7_144f_94a8_70b957517dac 2f117b41_7784_e39d_7d88_f5fa5ffeaa3e["toSql()"] 52f00476_8bee_baa2_0078_c831b1bd4433 -->|calls| 2f117b41_7784_e39d_7d88_f5fa5ffeaa3e style 52f00476_8bee_baa2_0078_c831b1bd4433 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-orm/src/sql/functions/vector.ts lines 125–133
export function cosineDistance(
column: SQLWrapper | AnyColumn,
value: number[] | string[] | TypedQueryBuilder<any> | string,
): SQL {
if (Array.isArray(value)) {
return sql`${column} <=> ${toSql(value)}`;
}
return sql`${column} <=> ${value}`;
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does cosineDistance() do?
cosineDistance() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/sql/functions/vector.ts.
Where is cosineDistance() defined?
cosineDistance() is defined in drizzle-orm/src/sql/functions/vector.ts at line 125.
What does cosineDistance() call?
cosineDistance() calls 1 function(s): toSql.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free