Object.LLMIntegration (object v0.1.2)

Enhanced LLM integration for AAOS objects using DSPy.

This module enables objects to:

  1. Respond to messages using LLM-powered natural language
  2. Generate contextual responses based on object state and history
  3. Adapt their communication style based on interaction patterns
  4. Use structured reasoning for complex decisions

Usage Examples:

# Basic LLM response generation
{:ok, response} = Object.LLMIntegration.generate_response(object, incoming_message)

# Contextual conversation
{:ok, response} = Object.LLMIntegration.conversational_response(object, message, conversation_history)

# Goal-oriented reasoning
{:ok, plan} = Object.LLMIntegration.reason_about_goal(object, goal, current_situation)

Summary

Functions

Enables objects to engage in collaborative reasoning with other objects.

Generates contextual conversation responses maintaining conversation state.

Creates a custom DSPy signature for specific object interactions.

Generates an LLM-powered response to an incoming message.

Uses LLM reasoning for complex goal-oriented decisions.

Registers a custom signature for reuse across objects.

Functions

collaborative_reasoning(objects, shared_problem, collaboration_type \\ :consensus)

Enables objects to engage in collaborative reasoning with other objects.

Parameters

  • objects: List of objects participating in reasoning
  • shared_problem: Problem to solve collaboratively
  • collaboration_type: Type of collaboration (:consensus, :negotiation, etc.)

Returns

{:ok, collaboration_result} with synthesized solution and role assignments

conversational_response(object, message, conversation_history \\ [])

Generates contextual conversation responses maintaining conversation state.

Parameters

  • object: The object in conversation
  • message: Current message to respond to
  • conversation_history: Previous messages in conversation (default: [])

Returns

{:ok, response, updated_object} with conversational response

create_custom_signature(name, description, inputs, outputs, instructions)

Creates a custom DSPy signature for specific object interactions.

Parameters

  • name: Name for the signature
  • description: Description of what the signature does
  • inputs: List of input fields
  • outputs: List of output fields
  • instructions: Instructions for the LLM

Returns

Signature specification map

generate_response(object, message, opts \\ [])

Generates an LLM-powered response to an incoming message.

Parameters

  • object: The object generating the response
  • message: Incoming message to respond to
  • opts: Options like :style, :max_length

Returns

{:ok, response, updated_object} with generated response and updated object state

Examples

iex> Object.LLMIntegration.generate_response(object, message)
{:ok, %{content: "I understand your request...", tone: "helpful"}, updated_object}

reason_about_goal(object, goal, current_situation, constraints \\ [])

Uses LLM reasoning for complex goal-oriented decisions.

Parameters

  • object: The reasoning object
  • goal: Goal to reason about
  • current_situation: Current state and context
  • constraints: Limitations to consider (default: [])

Returns

{:ok, reasoning_result, updated_object} with detailed reasoning analysis

register_signature(signature)

Registers a custom signature for reuse across objects.

Parameters

  • signature: Signature specification to register

Returns

{:ok, signature_name} on successful registration