Skip to main content

Crate cetai

Crate cetai 

Source
Expand description

Cetai(鲸语)— typed prompt! expressions and #[ai] functions for natural-language tasks over DeepSeek.

ⓘ
use cetai::{ai, prompt};

#[ai]
async fn summarize(article: String) -> cetai::Result<Summary> {
    prompt!("总结 {article}")
}

Referenced bindings are serialized and sent to the configured third-party model service. See the repository README.md / PLAN.md for the security and privacy boundary.

The HTTP transport layer is replaceable: the default reqwest-transport feature uses reqwest + tokio, while bevy, wasm and similar hosts can install their own Transport implementation via AiConfig::transport.

Macros§

prompt
Builds an AI prompt expression returning a future of cetai::Result<T>.

Structs§

AiConfig
A complete runtime configuration.
TransportError
传输层错误。
TransportRequest
一次 HTTP 传输请求,全部数据拥有所有权,可以送入 'static Future。
TransportResponse
一次 HTTP 传输响应。

Enums§

AiError
Errors returned by prompt! / #[ai] calls and configuration.
Thinking
Reasoning effort for a call.

Traits§

Transport
可替换的 HTTP 传输层。

Functions§

init
Initializes the global configuration.

Type Aliases§

BoxFuture
拥有所有权的装箱 Future 别名,等价于 futures crate 的 BoxFuture (std 未提供该别名),避免引入 futures 依赖。
Result
Result alias used by every cetai operation.

Attribute Macros§

ai
Marks an async fn whose whole body is a single prompt! call.