public class OmniRealtimeConversation
extends okhttp3.WebSocketListener
| 构造器和说明 |
|---|
OmniRealtimeConversation(OmniRealtimeParam param,
OmniRealtimeCallback callback)
Constructor
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
appendAudio(String audioBase64)
send audio in base64 format
|
void |
appendVideo(String videoBase64)
send one image frame in video in base64 format
|
void |
cancelResponse()
cancel the current response
|
void |
checkStatus()
Omni APIs
|
void |
clearAppendedAudio()
clear the audio sent to server before.
|
void |
close()
close the connection to server
|
void |
close(int code,
String reason)
close the connection to server
|
void |
commit()
Commit the audio and video sent before.
|
void |
connect()
Connect to server, create session and return default session configuration
|
void |
createResponse(String instructions,
List<OmniRealtimeModality> modalities)
create response, use audio and video commited before to request llm.
|
long |
getFirstAudioDelay() |
long |
getFirstTextDelay() |
String |
getResponseId() |
String |
getSessionId() |
void |
onClosed(okhttp3.WebSocket webSocket,
int code,
String reason) |
void |
onClosing(okhttp3.WebSocket webSocket,
int code,
String reason) |
void |
onFailure(okhttp3.WebSocket webSocket,
Throwable t,
okhttp3.Response response) |
void |
onMessage(okhttp3.WebSocket webSocket,
String text) |
void |
onOpen(okhttp3.WebSocket webSocket,
okhttp3.Response response)
WebSocket callbacks
|
void |
sendRaw(String rawData)
send raw data to server
|
void |
updateSession(OmniRealtimeConfig config)
Update session configuration, should be used before create response
|
public OmniRealtimeConversation(OmniRealtimeParam param, OmniRealtimeCallback callback)
param - apikey, model, url, etc.callback - callbackpublic void checkStatus()
public void connect()
throws NoApiKeyException,
InterruptedException
public void updateSession(OmniRealtimeConfig config)
config - session configurationpublic void appendAudio(String audioBase64)
audioBase64 - base64 audio stringpublic void appendVideo(String videoBase64)
videoBase64 - base64 image stringpublic void commit()
public void clearAppendedAudio()
public void createResponse(String instructions, List<OmniRealtimeModality> modalities)
instructions - instructions to llmmodalities - omni output modalities to be used in sessionpublic void cancelResponse()
public void close()
public void close(int code,
String reason)
code - websocket close codereason - websocket close reasonpublic void sendRaw(String rawData)
rawData - raw datapublic String getSessionId()
public String getResponseId()
public long getFirstAudioDelay()
public long getFirstTextDelay()
public void onOpen(okhttp3.WebSocket webSocket,
okhttp3.Response response)
onOpen 在类中 okhttp3.WebSocketListenerpublic void onMessage(okhttp3.WebSocket webSocket,
String text)
onMessage 在类中 okhttp3.WebSocketListenerpublic void onClosed(okhttp3.WebSocket webSocket,
int code,
String reason)
onClosed 在类中 okhttp3.WebSocketListenerpublic void onFailure(okhttp3.WebSocket webSocket,
Throwable t,
okhttp3.Response response)
onFailure 在类中 okhttp3.WebSocketListenerpublic void onClosing(@NotNull
okhttp3.WebSocket webSocket,
int code,
@NotNull
String reason)
onClosing 在类中 okhttp3.WebSocketListenerCopyright © 2025. All rights reserved.