|
| 1 | +import { AirweaveIcon } from '@/components/icons' |
| 2 | +import type { BlockConfig } from '@/blocks/types' |
| 3 | +import { AuthMode } from '@/blocks/types' |
| 4 | +import type { AirweaveSearchResponse } from '@/tools/airweave/types' |
| 5 | + |
| 6 | +export const AirweaveBlock: BlockConfig<AirweaveSearchResponse> = { |
| 7 | + type: 'airweave', |
| 8 | + name: 'Airweave', |
| 9 | + description: 'Search your synced data collections', |
| 10 | + authMode: AuthMode.ApiKey, |
| 11 | + longDescription: |
| 12 | + 'Search across your synced data sources using Airweave. Supports semantic search with hybrid, neural, or keyword retrieval strategies. Optionally generate AI-powered answers from search results.', |
| 13 | + docsLink: 'https://docs.airweave.ai', |
| 14 | + category: 'tools', |
| 15 | + bgColor: '#6366F1', |
| 16 | + icon: AirweaveIcon, |
| 17 | + subBlocks: [ |
| 18 | + { |
| 19 | + id: 'collectionId', |
| 20 | + title: 'Collection ID', |
| 21 | + type: 'short-input', |
| 22 | + placeholder: 'Enter your collection readable ID...', |
| 23 | + required: true, |
| 24 | + }, |
| 25 | + { |
| 26 | + id: 'query', |
| 27 | + title: 'Search Query', |
| 28 | + type: 'long-input', |
| 29 | + placeholder: 'Enter your search query...', |
| 30 | + required: true, |
| 31 | + }, |
| 32 | + { |
| 33 | + id: 'limit', |
| 34 | + title: 'Max Results', |
| 35 | + type: 'dropdown', |
| 36 | + options: [ |
| 37 | + { label: '10', id: '10' }, |
| 38 | + { label: '25', id: '25' }, |
| 39 | + { label: '50', id: '50' }, |
| 40 | + { label: '100', id: '100' }, |
| 41 | + ], |
| 42 | + value: () => '25', |
| 43 | + }, |
| 44 | + { |
| 45 | + id: 'retrievalStrategy', |
| 46 | + title: 'Retrieval Strategy', |
| 47 | + type: 'dropdown', |
| 48 | + options: [ |
| 49 | + { label: 'Hybrid (Default)', id: 'hybrid' }, |
| 50 | + { label: 'Neural', id: 'neural' }, |
| 51 | + { label: 'Keyword', id: 'keyword' }, |
| 52 | + ], |
| 53 | + value: () => 'hybrid', |
| 54 | + }, |
| 55 | + { |
| 56 | + id: 'expandQuery', |
| 57 | + title: 'Expand Query', |
| 58 | + type: 'switch', |
| 59 | + description: 'Generate query variations to improve recall', |
| 60 | + }, |
| 61 | + { |
| 62 | + id: 'rerank', |
| 63 | + title: 'Rerank Results', |
| 64 | + type: 'switch', |
| 65 | + description: 'Reorder results for improved relevance using LLM', |
| 66 | + }, |
| 67 | + { |
| 68 | + id: 'generateAnswer', |
| 69 | + title: 'Generate Answer', |
| 70 | + type: 'switch', |
| 71 | + description: 'Generate a natural-language answer from results', |
| 72 | + }, |
| 73 | + { |
| 74 | + id: 'apiKey', |
| 75 | + title: 'API Key', |
| 76 | + type: 'short-input', |
| 77 | + placeholder: 'Enter your Airweave API key', |
| 78 | + password: true, |
| 79 | + required: true, |
| 80 | + }, |
| 81 | + ], |
| 82 | + tools: { |
| 83 | + access: ['airweave_search'], |
| 84 | + }, |
| 85 | + inputs: { |
| 86 | + collectionId: { type: 'string', description: 'Airweave collection readable ID' }, |
| 87 | + query: { type: 'string', description: 'Search query text' }, |
| 88 | + apiKey: { type: 'string', description: 'Airweave API key' }, |
| 89 | + limit: { type: 'number', description: 'Maximum number of results' }, |
| 90 | + retrievalStrategy: { |
| 91 | + type: 'string', |
| 92 | + description: 'Retrieval strategy (hybrid/neural/keyword)', |
| 93 | + }, |
| 94 | + expandQuery: { type: 'boolean', description: 'Generate query variations' }, |
| 95 | + rerank: { type: 'boolean', description: 'Rerank results with LLM' }, |
| 96 | + generateAnswer: { type: 'boolean', description: 'Generate AI answer' }, |
| 97 | + }, |
| 98 | + outputs: { |
| 99 | + results: { type: 'json', description: 'Search results with content and metadata' }, |
| 100 | + completion: { type: 'string', description: 'AI-generated answer (when enabled)' }, |
| 101 | + }, |
| 102 | +} |
0 commit comments