View Source AI behaviour (fnord v0.4.23)

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

See AI.EmbeddingsAgent.get_embeddings/2.

See AI.Agent.CodeMapperAgent.

See AI.FileSummaryAgent.get_summary/3.

Create a new AI instance. Instances share the same client connection.

Types

@type t() :: %AI{
  api_key: term(),
  client: %OpenaiEx{
    _ep_path_mapping: term(),
    _http_headers: term(),
    base_url: term(),
    beta: term(),
    finch_name: term(),
    organization: term(),
    receive_timeout: term(),
    stream_timeout: term(),
    token: term()
  }
}

Callbacks

Link to this callback

get_embeddings(struct, t)

View Source
@callback get_embeddings(
  struct(),
  String.t()
) :: {:ok, [String.t()]} | {:error, term()}
Link to this callback

get_outline(struct, t, t)

View Source
@callback get_outline(struct(), String.t(), String.t()) ::
  {:ok, String.t()} | {:error, term()}
Link to this callback

get_summary(struct, t, t)

View Source
@callback get_summary(struct(), String.t(), String.t()) ::
  {:ok, String.t()} | {:error, term()}
@callback new() :: struct()

Functions

Link to this function

get_completion(ai, options \\ [])

View Source
Link to this function

get_embeddings(ai, text)

View Source

See AI.EmbeddingsAgent.get_embeddings/2.

Link to this function

get_outline(ai, file_path, file_content)

View Source

See AI.Agent.CodeMapperAgent.

Link to this function

get_summary(ai, file, text)

View Source

See AI.FileSummaryAgent.get_summary/3.

Create a new AI instance. Instances share the same client connection.