AiResource

Calls the Ovok AI routes under /ai.

  • Stable unknown
  • Release candidate since 0.1.0-rc.4
  • Development since 0.1.0-dev.24+fa54770
public final class AiResource

Calls the Ovok AI routes under /ai. Get it from Ovok.ai().

Methods

chat

public AiResource.ChatResource chat()

Returns the AI chat sessions and messages.

Returns: the chat resource

translate

public JsonNode translate(Object body) throws IOException, InterruptedException

Translates text (POST /ai/translation).

Parameters:

  • body: the translation request

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public JsonNode translate(
        Object body,
        RequestOptions options) throws IOException, InterruptedException

Translates text (POST /ai/translation).

Parameters:

  • body: the translation request
  • options: per-request options, such as the timeout

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

fhirSearch

public JsonNode fhirSearch(Object body) throws IOException, InterruptedException

Turns a natural-language question into a FHIR search (POST /ai/fhir/search).

Parameters:

  • body: the search request

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public JsonNode fhirSearch(
        Object body,
        RequestOptions options) throws IOException, InterruptedException

Turns a natural-language question into a FHIR search (POST /ai/fhir/search).

Parameters:

  • body: the search request
  • options: per-request options, such as the timeout

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

AiResource.ChatResource

public static final class ChatResource

AI chat sessions and their messages. Get it from AiResource.chat().

ChatResource.sessions

public AiResource.SessionsResource sessions()

Returns the chat sessions.

Returns: the sessions resource

ChatResource.messages

public AiResource.MessagesResource messages()

Returns the chat messages.

Returns: the messages resource

AiResource.SessionsResource

public static final class SessionsResource

AI chat sessions under /ai/session. Get it from ChatResource.sessions().

SessionsResource.create

public JsonNode create(Object body) throws IOException, InterruptedException

Starts a chat session (POST /ai/session).

Parameters:

  • body: the session to create

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public JsonNode create(Object body, RequestOptions options) throws IOException, InterruptedException

Starts a chat session (POST /ai/session).

Parameters:

  • body: the session to create
  • options: per-request options, such as the timeout

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

SessionsResource.list

public JsonNode list(Map<String, ?> parameters) throws IOException, InterruptedException

Lists chat sessions (GET /ai/session).

Parameters:

  • parameters: query parameters

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public JsonNode list() throws IOException, InterruptedException

Lists chat sessions (GET /ai/session).

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public JsonNode list(
        Map<String, ?> parameters,
        RequestOptions options) throws IOException, InterruptedException

Lists chat sessions (GET /ai/session).

Parameters:

  • parameters: query parameters
  • options: per-request options, such as the timeout

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

SessionsResource.retrieve

public JsonNode retrieve(String sessionId) throws IOException, InterruptedException

Reads a chat session (GET /ai/session/{id}).

Parameters:

  • sessionId: the session ID

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public JsonNode retrieve(
        String sessionId,
        Map<String, ?> parameters) throws IOException, InterruptedException

Reads a chat session (GET /ai/session/{id}).

Parameters:

  • sessionId: the session ID
  • parameters: query parameters

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public JsonNode retrieve(
        String sessionId,
        Map<String, ?> parameters,
        RequestOptions options) throws IOException, InterruptedException

Reads a chat session (GET /ai/session/{id}).

Parameters:

  • sessionId: the session ID
  • parameters: query parameters
  • options: per-request options, such as the timeout

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

AiResource.MessagesResource

public static final class MessagesResource

Messages in an AI chat session. Get it from ChatResource.messages().

MessagesResource.list

public JsonNode list(
        String sessionId,
        Map<String, ?> parameters) throws IOException, InterruptedException

Lists a session's messages (GET /ai/session/{id}/message).

Parameters:

  • sessionId: the session ID
  • parameters: query parameters

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public JsonNode list(
        String sessionId,
        Map<String, ?> parameters,
        RequestOptions options) throws IOException, InterruptedException

Lists a session's messages (GET /ai/session/{id}/message).

Parameters:

  • sessionId: the session ID
  • parameters: query parameters
  • options: per-request options, such as the timeout

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

MessagesResource.send

public JsonNode send(String sessionId, Object body) throws IOException, InterruptedException

Sends a message to a session (POST /ai/session/{id}/message).

Parameters:

  • sessionId: the session ID
  • body: the message

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public JsonNode send(
        String sessionId,
        Object body,
        RequestOptions options) throws IOException, InterruptedException

Sends a message to a session (POST /ai/session/{id}/message).

Parameters:

  • sessionId: the session ID
  • body: the message
  • options: per-request options, such as the timeout

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

Last updated on

On this page