XU XUv0.8.8
EN

API

#github.com/xulang-org/packages/chroma

import: chroma #github.com/xulang-org/packages/chroma

counts: 3 函数, 16 方法, 3 类型, 0 常量, 0 方法集

扩展包 `chroma #github.com/xulang-org/packages/chroma`,由模块 github.com/xulang-org/packages 提供。

github.com/xulang-org/packages · 0.1.1 · 安装与使用

struct Response

XuAPI
pub struct Response {
    pub status_code int
    pub headers string
    pub body string
}

用途

公开结构体 `Response`。

参数

status_code int
字段(int)
headers string
字段(string)
body string
正文

struct Client

XuAPI
pub struct Client {
    pub host string
    pub port int
    pub tenant string
    pub database string
}

用途

公开结构体 `Client`。

参数

host string
主机
port int
端口
tenant string
字段(string)
database string
字段(string)

new_client

XuAPI
pub fn new_client(endpoint string) Client

用途

构造 client。

参数

endpoint string
endpoint(string)

返回

Client — 该类型的值

(Client) request

XuAPI
pub fn (c Client) request(method string, path string, body string) Response

用途

`Client` 上的方法:请求。失败时 throw。

参数

c Client
接收者 Client(值接收者)
method string
method(string)
path string
文件系统路径(string)
body string
正文(string)

返回

Response — 该类型的值

(Client) heartbeat

XuAPI
pub fn (c Client) heartbeat() bool

用途

在 `Client` 上调用 `heartbeat`。

参数

c Client
接收者 Client(值接收者)

返回

bool — 是否成立

(Client) create_collection

XuAPI
pub fn (c Client) create_collection(name string) string

用途

`Client` 上的方法:创建collection。失败时 throw。

参数

c Client
接收者 Client(值接收者)
name string
名字(string)

返回

string — 结果字符串

(Client) add

XuAPI
pub fn (c Client) add(col_id string, ids_json string, embeddings_json string, documents_json string) bool

用途

`Client` 上的方法:相加。

参数

c Client
接收者 Client(值接收者)
col_id string
col_id(string)
ids_json string
ids_json(string)
embeddings_json string
embeddings_json(string)
documents_json string
documents_json(string)

返回

bool — 是否成立

(Client) query

XuAPI
pub fn (c Client) query(col_id string, query_embeddings_json string, n_results int) string

用途

`Client` 上的方法:查询串。失败时 throw。

参数

c Client
接收者 Client(值接收者)
col_id string
col_id(string)
query_embeddings_json string
query_embeddings_json(string)
n_results int
n_results(int)

返回

string — 结果字符串

(Client) delete_collection

XuAPI
pub fn (c Client) delete_collection(name string) bool

用途

`Client` 上的方法:删除collection。

参数

c Client
接收者 Client(值接收者)
name string
名字(string)

返回

bool — 是否成立

struct Pool

XuAPI
pub struct Pool {
    pub client Client
    pub state chan pool.State
    pub max_idle int
}

用途

公开结构体 `Pool`。

参数

client Client
字段(Client)
state chan pool.State
字段(通道;类型 chan pool.State)
max_idle int
字段(int)

new_pool

XuAPI
pub fn new_pool(endpoint string, max_idle int) Pool

用途

构造 pool。

参数

endpoint string
endpoint(string)
max_idle int
max_idle(int)

返回

Pool — 该类型的值

(&Pool) dup

XuAPI
pub fn (p &Pool) dup() Pool

用途

在 `&Pool` 上调用 `dup`。

参数

p &Pool
接收者 &Pool(借用)

返回

Pool — 该类型的值

(&Pool) get_conn

XuAPI
pub fn (p &Pool) get_conn() int

用途

`&Pool` 上的方法:读取 conn。

参数

p &Pool
接收者 &Pool(借用)

返回

int — 该类型的值

(&Pool) put_conn

XuAPI
pub fn (p &Pool) put_conn(fd int)

用途

`&Pool` 上的方法:put连接。

参数

p &Pool
接收者 &Pool(借用)
fd int
文件描述符(int)

(&Pool) discard_conn

XuAPI
pub fn (p &Pool) discard_conn(fd int)

用途

`&Pool` 上的方法:丢弃连接。

参数

p &Pool
接收者 &Pool(借用)
fd int
文件描述符(int)

open_pool

XuAPI
pub fn open_pool(endpoint string, max_idle int) Pool

用途

打开pool。

参数

endpoint string
endpoint(string)
max_idle int
max_idle(int)

返回

Pool — 该类型的值

(&Pool) heartbeat

XuAPI
pub fn (p &Pool) heartbeat() bool

用途

在 `&Pool` 上调用 `heartbeat`。

参数

p &Pool
接收者 &Pool(借用)

返回

bool — 是否成立

(&Pool) create_collection

XuAPI
pub fn (p &Pool) create_collection(name string) string

用途

`&Pool` 上的方法:创建collection。失败时 throw。

参数

p &Pool
接收者 &Pool(借用)
name string
名字(string)

返回

string — 结果字符串

(&Pool) add

XuAPI
pub fn (p &Pool) add(col_id string, ids_json string, embeddings_json string, documents_json string) bool

用途

`&Pool` 上的方法:相加。

参数

p &Pool
接收者 &Pool(借用)
col_id string
col_id(string)
ids_json string
ids_json(string)
embeddings_json string
embeddings_json(string)
documents_json string
documents_json(string)

返回

bool — 是否成立

(&Pool) query

XuAPI
pub fn (p &Pool) query(col_id string, query_embeddings_json string, n_results int) string

用途

`&Pool` 上的方法:查询串。失败时 throw。

参数

p &Pool
接收者 &Pool(借用)
col_id string
col_id(string)
query_embeddings_json string
query_embeddings_json(string)
n_results int
n_results(int)

返回

string — 结果字符串

(&Pool) delete_collection

XuAPI
pub fn (p &Pool) delete_collection(name string) bool

用途

`&Pool` 上的方法:删除collection。

参数

p &Pool
接收者 &Pool(借用)
name string
名字(string)

返回

bool — 是否成立

(&Pool) close

XuAPI
pub fn (p &Pool) close()

用途

`&Pool` 上的方法:关闭资源。

参数

p &Pool
接收者 &Pool(借用)