View Source AI behaviour (fnord v0.4.12)

AI is a behavior module that defines the interface for interacting with OpenAI's API. It provides a common interface for the various OpenAI-powered operations used by the application.

Summary

Functions

Get embeddings for the given text. The text is split into chunks of 8192 tokens to avoid exceeding the model's input limit. Returns a list of embeddings for each chunk.

Get a summary of the given text. The text is truncated to 128k tokens to avoid exceeding the model's input limit. Returns a summary of the text.

Callbacks

@callback get_embeddings(String.t()) :: {:ok, [String.t()]} | {:error, term()}
@callback get_summary(String.t(), String.t()) :: {:ok, String.t()} | {:error, term()}

Functions

Link to this function

add_user_message(thread_id, message)

View Source
Link to this function

create_assistant(params)

View Source
Link to this function

get_assistant(assistant_id)

View Source

Get embeddings for the given text. The text is split into chunks of 8192 tokens to avoid exceeding the model's input limit. Returns a list of embeddings for each chunk.

Link to this function

get_messages(thread_id, params \\ [])

View Source

Get a summary of the given text. The text is truncated to 128k tokens to avoid exceeding the model's input limit. Returns a summary of the text.

Link to this function

get_thread_run(thread_id, run_id)

View Source
Link to this function

run_thread(assistant_id, thread_id)

View Source
Link to this function

split_text(input, max_tokens)

View Source
Link to this function

submit_tool_outputs(thread_id, run_id, outputs)

View Source
Link to this function

update_assistant(assistant_id, params)

View Source