d25d482dc2
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
93 lines
2.8 KiB
TypeScript
93 lines
2.8 KiB
TypeScript
import type { PineconeDescribeIndexStatsParams, PineconeResponse } from '@/tools/pinecone/types'
|
|
import { parseJsonParam } from '@/tools/pinecone/utils'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const describeIndexStatsTool: ToolConfig<
|
|
PineconeDescribeIndexStatsParams,
|
|
PineconeResponse
|
|
> = {
|
|
id: 'pinecone_describe_index_stats',
|
|
name: 'Pinecone Describe Index Stats',
|
|
description: 'Get statistics about a Pinecone index, including per-namespace vector counts',
|
|
version: '1.0',
|
|
|
|
params: {
|
|
indexHost: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Full Pinecone index host URL (e.g., "https://my-index-abc123.svc.pinecone.io")',
|
|
},
|
|
filter: {
|
|
type: 'object',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description:
|
|
'Metadata filter to limit which vectors are counted (pod-based indexes only, e.g., {"category": {"$eq": "product"}})',
|
|
},
|
|
apiKey: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'Pinecone API key',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
method: 'POST',
|
|
url: (params) => `${params.indexHost}/describe_index_stats`,
|
|
headers: (params) => ({
|
|
'Api-Key': params.apiKey,
|
|
'Content-Type': 'application/json',
|
|
'X-Pinecone-API-Version': '2025-01',
|
|
}),
|
|
body: (params) => {
|
|
const body: Record<string, unknown> = {}
|
|
if (params.filter != null && params.filter !== '') {
|
|
body.filter = parseJsonParam(params.filter, 'filter')
|
|
}
|
|
return body
|
|
},
|
|
},
|
|
|
|
transformResponse: async (response) => {
|
|
const data = await response.json()
|
|
const rawNamespaces = (data.namespaces ?? {}) as Record<
|
|
string,
|
|
{ vectorCount?: number; vector_count?: number }
|
|
>
|
|
const namespaces: Record<string, { vectorCount: number | null }> = {}
|
|
for (const [name, summary] of Object.entries(rawNamespaces)) {
|
|
namespaces[name] = { vectorCount: summary.vectorCount ?? summary.vector_count ?? null }
|
|
}
|
|
return {
|
|
success: true,
|
|
output: {
|
|
namespaces,
|
|
dimension: data.dimension ?? null,
|
|
indexFullness: data.indexFullness ?? data.index_fullness ?? null,
|
|
totalVectorCount: data.totalVectorCount ?? data.total_vector_count ?? null,
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
namespaces: {
|
|
type: 'json',
|
|
description: 'Map of namespace name to its summary including vectorCount',
|
|
},
|
|
dimension: {
|
|
type: 'number',
|
|
description: 'Dimensionality of the indexed vectors',
|
|
},
|
|
indexFullness: {
|
|
type: 'number',
|
|
description: 'Fullness of the index (pod-based indexes only)',
|
|
},
|
|
totalVectorCount: {
|
|
type: 'number',
|
|
description: 'Total number of vectors across all namespaces',
|
|
},
|
|
},
|
|
}
|