public interface CozeLoopClient extends AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the client (alias for shutdown).
|
ExecuteResult |
execute(ExecuteParam param)
Execute a prompt.
|
StreamReader<ExecuteResult> |
executeStreaming(ExecuteParam param)
Execute a prompt with streaming response.
|
CozeLoopContext |
extractContext(Map<String,String> headers)
Extract context from headers for cross-service propagation.
|
void |
flush()
Flush all pending spans to the backend.
|
List<Message> |
formatPrompt(Prompt prompt,
Map<String,Object> variables)
Format a prompt with variables.
|
List<Message> |
getAndFormatPrompt(GetPromptParam param,
Map<String,Object> variables)
Get and format a prompt in one call.
|
Prompt |
getPrompt(GetPromptParam param)
Get a prompt from the platform.
|
String |
getWorkspaceId()
Get the workspace ID.
|
void |
invalidatePromptCache(GetPromptParam param)
Invalidate cached prompt.
|
void |
shutdown()
Shutdown the client and release resources.
|
CozeLoopSpan |
startSpan(String name)
Start a new span with default type "custom".
|
CozeLoopSpan |
startSpan(String name,
String spanType)
Start a new span with specified type.
|
CozeLoopSpan |
startSpan(String name,
String spanType,
CozeLoopContext parentContext)
Start a new span with specified type and parent context.
|
CozeLoopSpan |
startSpan(String name,
String spanType,
CozeLoopContext parentContext,
String scene) |
CozeLoopSpan |
startSpan(String name,
String spanType,
CozeLoopSpan parentSpan)
Start a new span with specified type.
|
CozeLoopSpan |
startSpan(String name,
String spanType,
CozeLoopSpan parentSpan,
String scene) |
CozeLoopSpan |
startSpan(String name,
String spanType,
String scene) |
CozeLoopSpan startSpan(String name)
name - the span nameCozeLoopSpan startSpan(String name, String spanType)
name - the span namespanType - the span type (e.g., "llm", "tool", "custom")CozeLoopSpan startSpan(String name, String spanType, String scene)
CozeLoopSpan startSpan(String name, String spanType, CozeLoopSpan parentSpan)
name - the span namespanType - the span type (e.g., "llm", "tool", "custom")CozeLoopSpan startSpan(String name, String spanType, CozeLoopSpan parentSpan, String scene)
CozeLoopSpan startSpan(String name, String spanType, CozeLoopContext parentContext)
name - the span namespanType - the span typeparentContext - the parent contextCozeLoopSpan startSpan(String name, String spanType, CozeLoopContext parentContext, String scene)
CozeLoopContext extractContext(Map<String,String> headers)
headers - the map of headers (e.g. from an incoming HTTP request)Prompt getPrompt(GetPromptParam param)
param - the parameters for getting promptList<Message> formatPrompt(Prompt prompt, Map<String,Object> variables)
prompt - the prompt to formatvariables - the variables to substituteList<Message> getAndFormatPrompt(GetPromptParam param, Map<String,Object> variables)
param - the parameters for getting promptvariables - the variables to substitutevoid invalidatePromptCache(GetPromptParam param)
param - the parameters identifying the promptExecuteResult execute(ExecuteParam param)
param - the execution parametersStreamReader<ExecuteResult> executeStreaming(ExecuteParam param)
param - the execution parametersString getWorkspaceId()
void flush()
void shutdown()
void close()
close in interface AutoCloseableCopyright © 2026. All rights reserved.