docs: add a minimal opentenbase_ai + pgvector integration example (embedding + similarity search)

未关闭
#325 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

  • #327 来自 @muzimu217 —— 已关闭,未合并

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
文档
描述清晰度
描述清楚
活跃度
停滞
技术栈
postgresql, sql

调研方向

Read contrib/opentenbase_ai/opentenbase_ai--1.0.sql for the documented function signatures, then check the bundled contrib/pgvector and contrib/pgsql-http setup. Draft one self-contained document under contrib/opentenbase_ai/ covering model registration, embedding casts, inserts, similarity search, and the stated limits and FAQ. Done when the example is runnable as written and clearly labels verified steps versus expected results.

由索引模型根据 Issue 内容生成。

描述

Motivation

Issue #304 tracks a README for contrib/opentenbase_ai. While walking through the extension's SQL interface (opentenbase_ai--1.0.sql), I noticed there is no runnable end-to-end example showing how opentenbase_ai combines with the bundled contrib/pgvector (the vector extension) — which is the most natural way to evaluate this extension in practice: register an embedding model, store embeddings in a table, and run a similarity search.

Proposal

Add a single self-contained example document under contrib/opentenbase_ai/, covering:

  1. Prerequisites — both dependencies are bundled in this repo: http (contrib/pgsql-http, declared by opentenbase_ai.control via requires = 'http') and vector (contrib/pgvector).
  2. Register an OpenAI-compatible embedding model with ai.add_embedding_model(model_name, uri, default_args, token).
  3. Call ai.embedding(input) — note it returns text (the JSON array extracted from the HTTP response), so the example shows the explicit ::vector cast into a pgvector column.
  4. Create a vector column table, insert, and run a nearest-neighbour query with the pgvector distance operators.
  5. Notes and limits: which steps are verified vs. expected results (clearly labeled), behavior when the endpoint is unreachable (the invoke path surfaces errors rather than silently returning NULL), and a short FAQ.

The example will follow the exact function signatures in opentenbase_ai--1.0.sql and will not touch any existing file or build script — one new documentation file only.

I'll follow up with a PR referencing this issue.

主要语言
C
星标
946
派生
693
平均合并
5 分钟
30 天内合并 PR
1

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

OpenTenBase/OpenTenBase 的其他 Issue

查看 OpenTenBase/OpenTenBase 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。