chore: import upstream snapshot with attribution
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1 @@
|
||||
export { airweaveSearchTool } from './search'
|
||||
@@ -0,0 +1,130 @@
|
||||
import type { AirweaveSearchParams, AirweaveSearchResponse } from '@/tools/airweave/types'
|
||||
import { AIRWEAVE_SEARCH_RESULT_OUTPUT_PROPERTIES } from '@/tools/airweave/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const airweaveSearchTool: ToolConfig<AirweaveSearchParams, AirweaveSearchResponse> = {
|
||||
id: 'airweave_search',
|
||||
name: 'Airweave Search',
|
||||
description:
|
||||
'Search your synced data collections using Airweave. Supports semantic search with hybrid, neural, or keyword retrieval strategies. Optionally generate AI-powered answers from search results.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Airweave API Key for authentication',
|
||||
},
|
||||
collectionId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The readable ID of the collection to search',
|
||||
},
|
||||
query: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The search query text',
|
||||
},
|
||||
limit: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
description: 'Maximum number of results to return (default: 100)',
|
||||
},
|
||||
retrievalStrategy: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Retrieval strategy: hybrid (default), neural, or keyword',
|
||||
},
|
||||
expandQuery: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Generate query variations to improve recall',
|
||||
},
|
||||
rerank: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Reorder results for improved relevance using LLM',
|
||||
},
|
||||
generateAnswer: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Generate a natural-language answer to the query',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => `https://api.airweave.ai/collections/${params.collectionId}/search`,
|
||||
method: 'POST',
|
||||
headers: (params) => ({
|
||||
'X-API-Key': params.apiKey,
|
||||
'Content-Type': 'application/json',
|
||||
}),
|
||||
body: (params) => {
|
||||
const body: Record<string, any> = {
|
||||
query: params.query,
|
||||
}
|
||||
|
||||
// Only include optional parameters if explicitly set
|
||||
if (params.limit !== undefined) body.limit = Number(params.limit)
|
||||
if (params.retrievalStrategy) body.retrieval_strategy = params.retrievalStrategy
|
||||
if (params.expandQuery !== undefined) body.expand_query = params.expandQuery
|
||||
if (params.rerank !== undefined) body.rerank = params.rerank
|
||||
if (params.generateAnswer !== undefined) body.generate_answer = params.generateAnswer
|
||||
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
// Handle error responses
|
||||
if (!response.ok) {
|
||||
return {
|
||||
success: false,
|
||||
output: { results: [] },
|
||||
error: data.detail ?? data.message ?? 'Search request failed',
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
results: (data.results ?? []).map((result: any) => ({
|
||||
entity_id: result.entity_id ?? result.id ?? '',
|
||||
source_name: result.source_name ?? '',
|
||||
md_content: result.md_content ?? null,
|
||||
score: result.score ?? 0,
|
||||
metadata: result.metadata ?? null,
|
||||
breadcrumbs: result.breadcrumbs ?? null,
|
||||
url: result.url ?? null,
|
||||
})),
|
||||
...(data.completion && { completion: data.completion }),
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
results: {
|
||||
type: 'array',
|
||||
description: 'Search results with content, scores, and metadata from your synced data',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: AIRWEAVE_SEARCH_RESULT_OUTPUT_PROPERTIES,
|
||||
},
|
||||
},
|
||||
completion: {
|
||||
type: 'string',
|
||||
description: 'AI-generated answer to the query (when generateAnswer is enabled)',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
import type { OutputProperty, ToolResponse } from '@/tools/types'
|
||||
|
||||
/**
|
||||
* Output definition for Airweave search result items.
|
||||
* Based on Airweave Search API response format.
|
||||
*/
|
||||
export const AIRWEAVE_SEARCH_RESULT_OUTPUT_PROPERTIES = {
|
||||
entity_id: { type: 'string', description: 'Unique identifier for the search result entity' },
|
||||
source_name: { type: 'string', description: 'Name of the data source (e.g., "GitHub", "Slack")' },
|
||||
md_content: {
|
||||
type: 'string',
|
||||
description: 'Markdown-formatted content of the result',
|
||||
optional: true,
|
||||
},
|
||||
score: { type: 'number', description: 'Relevance score from the search' },
|
||||
metadata: {
|
||||
type: 'object',
|
||||
description: 'Additional metadata associated with the result',
|
||||
optional: true,
|
||||
},
|
||||
breadcrumbs: {
|
||||
type: 'array',
|
||||
description: 'Navigation path to the result within its source',
|
||||
optional: true,
|
||||
items: { type: 'string', description: 'Breadcrumb segment' },
|
||||
},
|
||||
url: { type: 'string', description: 'URL to the original content', optional: true },
|
||||
} as const satisfies Record<string, OutputProperty>
|
||||
|
||||
/**
|
||||
* Complete search result output definition.
|
||||
*/
|
||||
export const AIRWEAVE_SEARCH_RESULT_OUTPUT: OutputProperty = {
|
||||
type: 'object',
|
||||
description: 'Search result item with content and metadata',
|
||||
properties: AIRWEAVE_SEARCH_RESULT_OUTPUT_PROPERTIES,
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameters for Airweave search requests.
|
||||
*/
|
||||
export interface AirweaveSearchParams {
|
||||
/** Airweave API Key for authentication */
|
||||
apiKey: string
|
||||
/** The readable ID of the collection to search */
|
||||
collectionId: string
|
||||
/** The search query text */
|
||||
query: string
|
||||
/** Maximum number of results to return */
|
||||
limit?: number
|
||||
/** Retrieval strategy: hybrid, neural, or keyword */
|
||||
retrievalStrategy?: 'hybrid' | 'neural' | 'keyword'
|
||||
/** Generate query variations to improve recall */
|
||||
expandQuery?: boolean
|
||||
/** Reorder results for improved relevance using LLM */
|
||||
rerank?: boolean
|
||||
/** Generate a natural-language answer to the query */
|
||||
generateAnswer?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Individual search result from Airweave.
|
||||
*/
|
||||
interface AirweaveSearchResult {
|
||||
entity_id: string
|
||||
source_name: string
|
||||
md_content?: string
|
||||
score: number
|
||||
metadata?: Record<string, any>
|
||||
breadcrumbs?: string[]
|
||||
url?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Response from Airweave search API.
|
||||
*/
|
||||
export interface AirweaveSearchResponse extends ToolResponse {
|
||||
output: {
|
||||
/** Array of search results */
|
||||
results: AirweaveSearchResult[]
|
||||
/** AI-generated answer to the query (when generateAnswer is true) */
|
||||
completion?: string
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user