createContentEmbeddingImpl() — supabase Function Reference
Architecture documentation for the createContentEmbeddingImpl() function in openAi.ts from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD bbe8c9d6_38a6_afdc_60ce_6c5a3c9c1904["createContentEmbeddingImpl()"] 1ee162b1_d232_4846_ef61_0018a3d5f851["error()"] bbe8c9d6_38a6_afdc_60ce_6c5a3c9c1904 -->|calls| 1ee162b1_d232_4846_ef61_0018a3d5f851 2373fead_7dbc_efa1_871c_2e08f6c27649["ok()"] bbe8c9d6_38a6_afdc_60ce_6c5a3c9c1904 -->|calls| 2373fead_7dbc_efa1_871c_2e08f6c27649 style bbe8c9d6_38a6_afdc_60ce_6c5a3c9c1904 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/docs/lib/openAi.ts lines 44–71
private async createContentEmbeddingImpl(
text: string
): Promise<Result<EmbeddingWithTokens, ApiError<ModerationFlaggedDetails>>> {
const query = text.trim()
const moderationResponse = await this.client.moderations.create({ input: query })
const [result] = moderationResponse.results
if (result.flagged) {
return Result.error(
new InvalidRequestError('Content flagged as inappropriate', undefined, {
flagged: true,
categories: result.categories,
})
)
}
const embeddingsResponse = await this.client.embeddings.create({
model: OpenAIClient.CONTENT_EMBEDDING_MODEL,
input: query,
})
const [{ embedding: queryEmbedding }] = embeddingsResponse.data
const tokenCount = embeddingsResponse.usage.total_tokens
return Result.ok({
embedding: queryEmbedding,
token_count: tokenCount,
})
}
Domain
Subdomains
Source
Frequently Asked Questions
What does createContentEmbeddingImpl() do?
createContentEmbeddingImpl() is a function in the supabase codebase.
What does createContentEmbeddingImpl() call?
createContentEmbeddingImpl() calls 2 function(s): error, ok.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free