@findable-ai/sdk

中文文档
0.34.0发布于 2026/11/12MITTypeScriptESM + CJS零依赖近 30 天下载 5858

TypeScript client for the Findable Partner API

原始使用文档
文档目录12 节
  1. Installation
  2. Quick start
  3. Streaming
  4. Stream events
  5. API reference
  6. FindableClient
  7. Methods
  8. Options
  9. Error handling
  10. React
  11. Documentation
  12. Licence

@findable-ai/sdk

Zero-dependency TypeScript client for the Findable Partner API. Works in browsers, Node.js, and any runtime with native fetch.

npm version

Full documentation: docs.findable.ai

Installation

npm install @findable-ai/sdk

Quick start

import { FindableClient } from '@findable-ai/sdk';

const client = new FindableClient({
  apiKey: 'YOUR_API_KEY',
  buildingOwnerId: 'YOUR_BUILDING_OWNER_ID',
});

// Search documents
const results = await client.search({ query: 'fire safety', buildingId: 'bld-123' });
console.log(results.hits);

// Ask a question (non-streaming)
const answer = await client.assistant({
  buildingId: 'bld-123',
  query: 'What are the fire safety requirements?',
});
console.log(answer.answer);

Streaming

assistantStream() returns an async iterable with real-time server-sent events:

const stream = client.assistantStream({
  buildingId: 'bld-123',
  query: 'Summarise the ventilation specs',
});

for await (const event of stream) {
  switch (event.event) {
    case 'text':
      process.stdout.write(event.text);
      break;
    case 'finish':
      console.log('\n\nCitations:', event.citations);
      break;
  }
}

// Cancel at any time
stream.abort();

Stream events

EventFieldsDescription
startthreadIdStream opened, thread created
texttextIncremental answer text chunk
thinkingtextModel reasoning text (when using high reasoning effort)
actionstate, value, resultAgent progress/action update
finishanswer, threadId, citations, citedDocuments, followUpSuggestionsComplete response with metadata
errormessageError occurred

API reference

FindableClient

new FindableClient({ apiKey: string, buildingOwnerId: string, baseUrl?: string })

Methods

MethodReturnsDescription
assistant(options)Promise<AssistantResponse>Ask a question, get a complete response
assistantStream(options)AsyncIterable<AssistantStreamEvent> & { abort() }Ask with real-time streaming
assistantAcrossBuildings(options)Promise<AssistantResponse>Ask across buildings, get a complete response
assistantAcrossBuildingsStream(options)AsyncIterable<AssistantStreamEvent> & { abort() }Ask across buildings with real-time streaming
search(options)Promise<SearchResult>Search documents
listBuildings()Promise<Building[]>List all buildings
getBuilding(id)Promise<Building>Get a single building

The earlier names ask(), askStream(), askAcrossBuildings() and askAcrossBuildingsStream(), and the Ask* types, are deprecated. They keep working and have no removal date; replace ask with assistant in the name when you next touch the code.

Options

// Assistant
{ buildingId: string, query: string, language?: 'en' | 'no' | 'nb' | 'nn',
  threadId?: string, attachedDocumentIds?: string[], mode?: 'fast' | 'balanced' | 'deep',
  reasoningEffort?: 'low' | 'medium' | 'high' /* deprecated */, useAgenticRag?: boolean }

// Search
{ query: string, buildingId?: string, maxResults?: number, startIndex?: number }

Choosing how much work goes into an answer

mode is one setting with three positions:

modeWhat you get
'fast'Cheapest and quickest: roughly 15x cheaper than 'balanced' and several times faster, with shallower synthesis across many documents.
'balanced'The default. What every request gets when mode is omitted.
'deep'Most thorough and most expensive. For questions that genuinely need extensive reasoning across many sources.

Prefer 'fast' for lookups and single-document questions. If you run the Assistant in a batch (for example a nightly job asking the same questions of the same buildings), this is the setting that matters most for cost.

Omit mode and nothing changes: requests are answered exactly as they were before the option existed.

reasoningEffort is deprecated in favour of mode. It was never a separate dial: 'high' behaves like mode: 'deep', and 'low' and 'medium' both behave like mode: 'balanced'. It is still accepted with that behaviour, and ignored when mode is set.

Error handling

import {
  FindableClient,
  AuthError,
  NotFoundError,
  FindableError,
} from '@findable-ai/sdk';

try {
  await client.assistant({ buildingId: 'bld-123', query: 'Hello' });
} catch (err) {
  if (err instanceof AuthError) {
    // Invalid or missing API key (401/403)
  } else if (err instanceof NotFoundError) {
    // Building not found (404)
  } else if (err instanceof FindableError) {
    // Other API error — check err.status and err.message
  }
}

React

For drop-in React components and hooks, see @findable-ai/react.

Documentation

Licence

MIT

版本与发布记录

@findable-ai/sdk 共发布 9 个版本,首次发布于 2026/03/01;过去 12 个月发布了 9 个版本。

版本发布日期距今
0.34.0latest2026/11/122 天前
0.33.102026/06/304 个月前
0.33.72026/06/294 个月前
0.2.42026/03/038 个月前
0.2.32026/03/038 个月前
0.2.22026/03/018 个月前

关于 @findable-ai/sdk 的常见问题

@findable-ai/sdk 是什么?

TypeScript client for the Findable Partner API

如何安装 @findable-ai/sdk?

在项目目录运行 npm install @findable-ai/sdk,或使用 pnpm add / yarn add / bun add。

@findable-ai/sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@findable-ai/sdk 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@findable-ai/sdk 可以商用吗?

@findable-ai/sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@findable-ai/sdk 的下载量有多少?

根据 npm 官方下载统计,@findable-ai/sdk 在 2026/10/15 – 2026/11/13 这 30 天内被下载 5,858 次,日均约 195 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@findable-ai/sdk 还在维护吗?

最新版本 0.34.0 发布于 2026/11/12(2 天前);至今共发布 9 个版本,其中过去 12 个月发布了 9 个;首次发布于 2026/03/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。