public class CozeLoopClientImpl extends Object implements CozeLoopClient
| Constructor and Description |
|---|
CozeLoopClientImpl(String workspaceId,
CozeLoopTracerProvider tracerProvider,
PromptProvider promptProvider,
HttpClient httpClient) |
| 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) |
public CozeLoopClientImpl(String workspaceId, CozeLoopTracerProvider tracerProvider, PromptProvider promptProvider, HttpClient httpClient)
public CozeLoopSpan startSpan(String name)
CozeLoopClientstartSpan in interface CozeLoopClientname - the span namepublic CozeLoopSpan startSpan(String name, String spanType)
CozeLoopClientstartSpan in interface CozeLoopClientname - the span namespanType - the span type (e.g., "llm", "tool", "custom")public CozeLoopSpan startSpan(String name, String spanType, String scene)
startSpan in interface CozeLoopClientpublic CozeLoopSpan startSpan(String name, String spanType, CozeLoopSpan parentSpan)
CozeLoopClientstartSpan in interface CozeLoopClientname - the span namespanType - the span type (e.g., "llm", "tool", "custom")public CozeLoopSpan startSpan(String name, String spanType, CozeLoopSpan parentSpan, String scene)
startSpan in interface CozeLoopClientpublic CozeLoopSpan startSpan(String name, String spanType, CozeLoopContext parentContext)
CozeLoopClientstartSpan in interface CozeLoopClientname - the span namespanType - the span typeparentContext - the parent contextpublic CozeLoopSpan startSpan(String name, String spanType, CozeLoopContext parentContext, String scene)
startSpan in interface CozeLoopClientpublic CozeLoopContext extractContext(Map<String,String> headers)
CozeLoopClientextractContext in interface CozeLoopClientheaders - the map of headers (e.g. from an incoming HTTP request)public Prompt getPrompt(GetPromptParam param)
CozeLoopClientgetPrompt in interface CozeLoopClientparam - the parameters for getting promptpublic List<Message> formatPrompt(Prompt prompt, Map<String,Object> variables)
CozeLoopClientformatPrompt in interface CozeLoopClientprompt - the prompt to formatvariables - the variables to substitutepublic List<Message> getAndFormatPrompt(GetPromptParam param, Map<String,Object> variables)
CozeLoopClientgetAndFormatPrompt in interface CozeLoopClientparam - the parameters for getting promptvariables - the variables to substitutepublic void invalidatePromptCache(GetPromptParam param)
CozeLoopClientinvalidatePromptCache in interface CozeLoopClientparam - the parameters identifying the promptpublic ExecuteResult execute(ExecuteParam param)
CozeLoopClientexecute in interface CozeLoopClientparam - the execution parameterspublic StreamReader<ExecuteResult> executeStreaming(ExecuteParam param)
CozeLoopClientexecuteStreaming in interface CozeLoopClientparam - the execution parameterspublic String getWorkspaceId()
CozeLoopClientgetWorkspaceId in interface CozeLoopClientpublic void flush()
CozeLoopClientflush in interface CozeLoopClientpublic void shutdown()
CozeLoopClientshutdown in interface CozeLoopClientpublic void close()
CozeLoopClientclose in interface CozeLoopClientclose in interface AutoCloseableCopyright © 2026. All rights reserved.