struct Response
pub struct Response {
pub status_code int
pub headers string
pub body string
}用途
公开结构体 `Response`。
参数
status_codeint- 字段(int)
headersstring- 字段(string)
bodystring- 正文
API
#github.com/xulang-org/packages/chroma扩展包 `chroma #github.com/xulang-org/packages/chroma`,由模块 github.com/xulang-org/packages 提供。
github.com/xulang-org/packages · 0.1.1 · 安装与使用
struct Responsepub struct Response {
pub status_code int
pub headers string
pub body string
}公开结构体 `Response`。
status_code intheaders stringbody stringstruct Clientpub struct Client {
pub host string
pub port int
pub tenant string
pub database string
}公开结构体 `Client`。
host stringport inttenant stringdatabase stringnew_clientpub fn new_client(endpoint string) Client构造 client。
endpoint stringClient — 该类型的值
(Client) requestpub fn (c Client) request(method string, path string, body string) Response`Client` 上的方法:请求。失败时 throw。
c Clientmethod stringpath stringbody stringResponse — 该类型的值
(Client) heartbeatpub fn (c Client) heartbeat() bool在 `Client` 上调用 `heartbeat`。
c Clientbool — 是否成立
(Client) create_collectionpub fn (c Client) create_collection(name string) string`Client` 上的方法:创建collection。失败时 throw。
c Clientname stringstring — 结果字符串
(Client) addpub fn (c Client) add(col_id string, ids_json string, embeddings_json string, documents_json string) bool`Client` 上的方法:相加。
c Clientcol_id stringids_json stringembeddings_json stringdocuments_json stringbool — 是否成立
(Client) querypub fn (c Client) query(col_id string, query_embeddings_json string, n_results int) string`Client` 上的方法:查询串。失败时 throw。
c Clientcol_id stringquery_embeddings_json stringn_results intstring — 结果字符串
(Client) delete_collectionpub fn (c Client) delete_collection(name string) bool`Client` 上的方法:删除collection。
c Clientname stringbool — 是否成立
struct Poolpub struct Pool {
pub client Client
pub state chan pool.State
pub max_idle int
}公开结构体 `Pool`。
client Clientstate chan pool.Statemax_idle intnew_poolpub fn new_pool(endpoint string, max_idle int) Pool构造 pool。
endpoint stringmax_idle intPool — 该类型的值
(&Pool) duppub fn (p &Pool) dup() Pool在 `&Pool` 上调用 `dup`。
p &PoolPool — 该类型的值
(&Pool) get_connpub fn (p &Pool) get_conn() int`&Pool` 上的方法:读取 conn。
p &Poolint — 该类型的值
(&Pool) put_connpub fn (p &Pool) put_conn(fd int)`&Pool` 上的方法:put连接。
p &Poolfd int(&Pool) discard_connpub fn (p &Pool) discard_conn(fd int)`&Pool` 上的方法:丢弃连接。
p &Poolfd intopen_poolpub fn open_pool(endpoint string, max_idle int) Pool打开pool。
endpoint stringmax_idle intPool — 该类型的值
(&Pool) heartbeatpub fn (p &Pool) heartbeat() bool在 `&Pool` 上调用 `heartbeat`。
p &Poolbool — 是否成立
(&Pool) create_collectionpub fn (p &Pool) create_collection(name string) string`&Pool` 上的方法:创建collection。失败时 throw。
p &Poolname stringstring — 结果字符串
(&Pool) addpub fn (p &Pool) add(col_id string, ids_json string, embeddings_json string, documents_json string) bool`&Pool` 上的方法:相加。
p &Poolcol_id stringids_json stringembeddings_json stringdocuments_json stringbool — 是否成立
(&Pool) querypub fn (p &Pool) query(col_id string, query_embeddings_json string, n_results int) string`&Pool` 上的方法:查询串。失败时 throw。
p &Poolcol_id stringquery_embeddings_json stringn_results intstring — 结果字符串
(&Pool) delete_collectionpub fn (p &Pool) delete_collection(name string) bool`&Pool` 上的方法:删除collection。
p &Poolname stringbool — 是否成立
(&Pool) closepub fn (p &Pool) close()`&Pool` 上的方法:关闭资源。
p &Pool