The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Agente IA con ChromaDB + Ollama + API Empresa",
"nodes": [
{
"parameters": {},
"id": "webhook",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
450,
300
],
"path": "ask-ai",
"method": "POST",
"responseMode": "lastNode",
"respondWithOptions": "responseNode"
},
{
"parameters": {
"requestMethod": "POST",
"url": "http://localhost:8000/api/v1/collections/{{ $env.CHROMA_COLLECTION_ID }}/query",
"jsonParameters": true,
"options": {},
"bodyParametersJson": "{\n \"query_texts\": [\"={{ $('Webhook').item.json.question }}\"],\n \"n_results\": 3\n}"
},
"id": "chroma-query",
"name": "Buscar en ChromaDB",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
650,
300
]
},
{
"parameters": {
"requestMethod": "POST",
"url": "http://localhost:11434/api/generate",
"jsonParameters": true,
"options": {},
"bodyParametersJson": "{\n \"model\": \"qwen2:7b\",\n \"prompt\": \"Contexto:\\n{{ $json.documents[0][0] }}\\n\\nPregunta: {{ $('Webhook').item.json.question }}\\n\\nInstrucci\u00f3n: Responde la pregunta usando SOLO el contexto. Si necesitas consultar la API de la empresa, responde EXACTAMENTE: 'API_NECESARIA:nombre_endpoint'.\",\n \"stream\": false\n}"
},
"id": "ollama-initial",
"name": "Ollama - Respuesta Inicial",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
850,
300
]
},
{
"parameters": {
"conditions": {
"boolean": [],
"string": [
{
"value1": "={{ $json.response.trim() }}",
"operation": "contains",
"value2": "API_NECESARIA:"
}
]
}
},
"id": "if-api-needed",
"name": "\u00bfNecesita API?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1050,
300
]
},
{
"parameters": {
"jsCode": "const response = $input.item.json.response.trim();\nconst match = response.match(/API_NECESARIA:(\\w+)/);\nif (!match) {\n return { error: \"No se pudo extraer el endpoint\" };\n}\n\nconst endpoint = match[1];\nlet apiUrl = \"\";\n\nswitch(endpoint) {\n case \"consulta_saldo\":\n apiUrl = \"http://localhost:3000/api/consulta-saldo\";\n break;\n case \"estado_pedido\":\n apiUrl = \"http://localhost:3000/api/estado-pedido\";\n break;\n default:\n throw new Error(\"Endpoint no soportado: \" + endpoint);\n}\n\nreturn {\n ...$input.item.json,\n apiUrl,\n endpoint,\n body: {\n clienteId: \"123\"\n }\n};"
},
"id": "extract-endpoint",
"name": "Extraer Endpoint",
"type": "n8n-nodes-base.functionItem",
"typeVersion": 1,
"position": [
1250,
200
]
},
{
"parameters": {
"requestMethod": "POST",
"url": "={{ $json.apiUrl }}",
"jsonParameters": true,
"options": {},
"bodyParametersJson": "={{ JSON.stringify($json.body) }}"
},
"id": "call-company-api",
"name": "Llamar API Empresa",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
1450,
200
]
},
{
"parameters": {
"requestMethod": "POST",
"url": "http://localhost:11434/api/generate",
"jsonParameters": true,
"options": {},
"bodyParametersJson": "{\n \"model\": \"qwen2:7b\",\n \"prompt\": \"Datos de la API: {{ JSON.stringify($json.body) }}\\n\\nInstrucci\u00f3n: Usa estos datos para responder claramente la pregunta original: {{ $('Webhook').item.json.question }}. S\u00e9 conciso y amable.\",\n \"stream\": false\n}"
},
"id": "ollama-final",
"name": "Ollama - Respuesta Final",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
1650,
200
]
},
{
"parameters": {
"responseCode": 200,
"responseData": "={{ $json.response }}",
"responseHeaders": "{\n \"Content-Type\": \"application/json\"\n}",
"options": {}
},
"id": "webhook-response",
"name": "Responder al Cliente",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
1850,
300
]
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Buscar en ChromaDB",
"type": "main",
"index": 0
}
]
]
},
"Buscar en ChromaDB": {
"main": [
[
{
"node": "Ollama - Respuesta Inicial",
"type": "main",
"index": 0
}
]
]
},
"Ollama - Respuesta Inicial": {
"main": [
[
{
"node": "\u00bfNecesita API?",
"type": "main",
"index": 0
}
]
]
},
"\u00bfNecesita API?": {
"main": [
[
{
"node": "Responder al Cliente",
"type": "main",
"index": 0
}
],
[
{
"node": "Extraer Endpoint",
"type": "main",
"index": 0
}
]
]
},
"Extraer Endpoint": {
"main": [
[
{
"node": "Llamar API Empresa",
"type": "main",
"index": 0
}
]
]
},
"Llamar API Empresa": {
"main": [
[
{
"node": "Ollama - Respuesta Final",
"type": "main",
"index": 0
}
]
]
},
"Ollama - Respuesta Final": {
"main": [
[
{
"node": "Responder al Cliente",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"staticData": null
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Agente IA con ChromaDB + Ollama + API Empresa. Uses httpRequest, functionItem. Webhook trigger; 8 nodes.
Source: https://gist.github.com/martorellleandro/1cc1e9cd558834e22a1d7b2642a6881c — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This workflow exposes a webhook-based FAQ endpoint that embeds incoming questions with OpenAI, retrieves relevant knowledge base chunks from Supabase pgvector, and asks Anthropic Claude to answer stri
Chatbot-Query-Qdrant. Uses httpRequest, postgres. Webhook trigger; 7 nodes.
Kreativ: RAG Ingestion Pipeline. Uses httpRequest, postgres. Webhook trigger; 5 nodes.
PRAGMAS - Ingest Paper. Uses executeCommand, httpRequest. Webhook trigger; 4 nodes.