AI Embeddings
Generates text embeddings for semantic search.
ai
Source
/**
* Demonstrates the AI embed kind. Generates embeddings for text
* to enable semantic search.
*/
webhook embed_request {
label: "Embed Request"
schema: @json {
{
"type": "object",
"required": ["text"],
"properties": {
"text": { "type": "string" },
"metadata": { "type": "object" }
}
}
}
}
workflow generate_embedding {
label: "Generate Embedding"
root {
type: code
label: "Extract text"
code: @ts { return context.nodes.root.input }
outputSchema: @json {
{
"type": "object",
"properties": {
"text": { "type": "string" },
"metadata": { "type": "object" }
}
}
}
}
node embed {
type: ai
label: "Generate embedding"
kind: embed
model: "openai/text-embedding-3-small"
prompt: @ts { return context.nodes.root.output.text }
}
node result {
type: code
label: "Format result"
code: @ts {
return {
text: context.nodes.root.output.text,
embedding: context.nodes.embed.output,
metadata: context.nodes.root.output.metadata || {}
}
}
}
flow {
root -> embed
embed -> result
}
}
trigger on_embed {
webhook:embed_request -> generate_embedding
enabled: true
}
Flow
Trigger to workflow
embed_requestwebhook
generate_embedding
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.
Workflow nodes
CODE
Code Node
Extract text
AI
AI Node
Generate embedding
CODE
Code Node
Format result
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.