> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hitheo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 構建 E.V.I.

> 通過自定義角色、技能和工具，將 Theo 嵌入你的產品。

E.V.I.（Embedded Virtual Intelligence，嵌入式虛擬智能）是嵌入在你產品中的 Theo。你的用戶將與你自有品牌的 AI 交互，而背後由 Theo 的編排引擎驅動。

## 你將構建什麼

```
Your Application (CRM, dashboard, app)
  └── Your UI (chat, sidebar, actions)
        └── @hitheo/sdk (evi instance)
              └── Theo API (api.hitheo.ai)
                    └── Classify → Skills → Route → Agent Loop → Response
```

## 第一級：僅自定義角色

```typescript theme={null}
const evi = theo.evi({
  persona: "You are Kai, a friendly coding assistant for DevHub.",
});

const res = await evi.complete({
  prompt: "Why is my useEffect running twice?",
});
```

## 第二級：角色 + 技能

```typescript theme={null}
const evi = theo.evi({
  persona: "You are Atlas, an operations assistant for AcmeCorp.",
  skills: ["inventory-check", "data-extraction"],
});
```

## 第三級：角色 + 技能 + 內聯工具

```typescript theme={null}
const evi = theo.evi({
  persona: "You are Nova, the AI assistant for WarehouseOS.",
  skills: ["data-extraction"],
  tools: [
    {
      name: "check_inventory",
      description: "Look up stock levels for a SKU",
      input_schema: {
        type: "object",
        properties: { sku: { type: "string" } },
        required: ["sku"],
      },
    },
  ],
});
```

## 流式

```typescript theme={null}
const stream = evi.stream({ prompt: "Generate inventory report" });
for await (const event of stream) {
  if (event.type === "token") process.stdout.write(event.token!);
}
```

## 最佳實踐

* **角色**：明確說明 E.V.I. 不應該做什麼（例如"絕不提及 Theo"）
* **技能**：只安裝你的使用場景真正需要的技能
* **工具**：保持描述清晰——模型會讀取這些描述來判斷何時調用
* **成本**：對簡單查詢使用 `mode: "fast"`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.