Foundry.LlmConversation

g Foundry.LlmConversation Foundry.LlmConversation GObject.Object GObject.Object GObject.Object->Foundry.LlmConversation

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

add_context (context)

call (call)

dup_tools ()

is_busy ()

list_history ()

reset ()

send_message (role, message)

send_messages (roles, messages)

set_tools (tools)

Virtual Methods

Inherited:

GObject.Object (7)

do_add_context (context)

do_call (call)

do_is_busy ()

do_list_history ()

do_reset ()

do_send_messages (roles, messages)

Properties

Name

Type

Flags

Short Description

is-busy

bool

r

tools

Gio.ListModel

r/w/en

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Foundry.LlmConversation(**kwargs)
Bases:

GObject.Object

Abstract:

Yes

Structure:

Foundry.LlmConversationClass

Abstract base class for managing conversations with large language models.

Foundry.LlmConversation provides the core interface for interacting with language models including message management, tool integration, and conversation state tracking. Concrete implementations handle specific LLM providers and maintain conversation context for development assistance.

add_context(context)
Parameters:

context (str) –

Returns:

a [class`Dex`.Future] that resolves to any value or rejects with error.

Return type:

Dex.Future

Adds context to the conversation.

Generally this applies to the conversation right after the system prompt.

call(call)
Parameters:

call (Foundry.LlmToolCall) – a [class`Foundry`.LlmToolCall]

Returns:

a [class`Dex`.Future] that resolves to a [class`Foundry`.LlmMessage] or rejects with error.

Return type:

Dex.Future

dup_tools()
Returns:

a [iface`Gio`.ListModel] of [class`Foundry`.LlmTool]

Return type:

Gio.ListModel

Lists tools made available to the conversation.

is_busy()
Return type:

bool

list_history()
Returns:

a [iface`Gio`.ListModel] of [class`Foundry`.LlmMessage].

Return type:

Gio.ListModel or None

List the available history of the conversation.

reset()

Reset the conversation to the initial state.

send_message(role, message)
Parameters:
  • role (str) – the role of the message sender

  • message (str) – the message to be sent

Returns:

a [class`Dex`.Future] that resolves to any value or rejects with error.

Return type:

Dex.Future

The role should generally be something like “system”, “user”, “assistant”, or “tool”.

send_messages(roles, messages)
Parameters:
  • roles (str) –

  • messages (str) –

Returns:

a [class`Dex`.Future] that resolves to any value or rejects with error.

Return type:

Dex.Future

Send multiple messages together.

The length of roles must be the same as messages.

set_tools(tools)
Parameters:

tools (Gio.ListModel) – a list model of [class`Foundry`.LlmTool]

Set the tools that are allowed to be used by the model.

do_add_context(context) virtual
Parameters:

context (str) –

Returns:

a [class`Dex`.Future] that resolves to any value or rejects with error.

Return type:

Dex.Future

Adds context to the conversation.

Generally this applies to the conversation right after the system prompt.

do_call(call) virtual
Parameters:

call (Foundry.LlmToolCall) – a [class`Foundry`.LlmToolCall]

Returns:

a [class`Dex`.Future] that resolves to a [class`Foundry`.LlmMessage] or rejects with error.

Return type:

Dex.Future

do_is_busy() virtual
Return type:

bool

do_list_history() virtual
Returns:

a [iface`Gio`.ListModel] of [class`Foundry`.LlmMessage].

Return type:

Gio.ListModel or None

List the available history of the conversation.

do_reset() virtual

Reset the conversation to the initial state.

do_send_messages(roles, messages) virtual
Parameters:
  • roles (str) –

  • messages (str) –

Returns:

a [class`Dex`.Future] that resolves to any value or rejects with error.

Return type:

Dex.Future

Send multiple messages together.

The length of roles must be the same as messages.

Property Details

Foundry.LlmConversation.props.is_busy
Name:

is-busy

Type:

bool

Default Value:

False

Flags:

READABLE

Foundry.LlmConversation.props.tools
Name:

tools

Type:

Gio.ListModel

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY