跳到主要内容

GraphQL 参考:ai-inference

本页由该服务提供的 Schema 自动生成,因此不会落后于实现。同一 Schema 也以文件形式发布,供工具和智能体使用。

端点https://<your-host>/api/ai-inference/graphql
认证平面service — Called by another DeviceChain service, not by an application. Documented for completeness; there is no supported way for a tenant client to call it.
授权方式service token
Schema 文件/schema/ai-inference.graphql
已描述12 个元素中的 12 个
说明Called by event-processing under its own service token when compiling a natural-language rule description. Not reachable with a tenant access token.
备注

下面的参考内容由 Schema 自动生成,仅提供英文版本。

Queries​

aiInferenceInfo

aiInferenceInfo​

Identifies the service answering. Requires no specific authority.

Returns ServiceInfo!

Mutations​

inferRuleCandidate

inferRuleCandidate​

Drafts a detection rule: sends the prompt to the model the calling tenant has been assigned for rule drafting, or else its tier's default model, and returns the output unvalidated. The tenant comes from the caller's token. The call fails if the tenant's tier offers no usable model or the provider has no API key (the error is only "inference is unavailable", whatever the cause), if the tenant has not opted in to external AI routing (a distinct error), if the tenant is over its inference rate limit (a distinct, retryable error), or if the prompt is blank or too large. The function cannot be chosen by the caller. Requires ai:infer.

Returns InferenceResult!

ArgumentTypeDescription
requestInferenceRequest!The prompt to send.

Objects​

InferenceResult · ServiceInfo

InferenceResult​

object

The model's answer to an inference request.

FieldTypeDescription
candidateString!The model's text output, returned as produced. It is a proposal only: nothing has validated it.
modelString!Identifier of the model that answered, as reported by the provider.
providerString!Token of the registered provider that served the call.

ServiceInfo​

object

Identity of the service answering the request.

FieldTypeDescription
areaString!The functional area this service serves; for this service, the AI inference area.

Input types​

InferenceRequest

InferenceRequest​

input

A prompt to send to the model. The output-token limit, the endpoint and the call timeout are fixed by the server and cannot be set by the caller.

Input fieldTypeDescription
promptString!The user prompt. Required, and must not be blank. The prompt and system prompt together may not exceed 128 KiB unless the operator configured a different limit.
systemStringOptional system prompt (instructions or persona) sent ahead of the prompt.