Class: Telnyx::Resources::AI::Assistants::Instructions

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/ai/assistants/instructions.rb

Overview

Configure AI assistant specifications

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Instructions

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Instructions.

Parameters:



57
58
59
# File 'lib/telnyx/resources/ai/assistants/instructions.rb', line 57

def initialize(client:)
  @client = client
end

Instance Method Details

#enhance(assistant_id, enhancement_prompt: nil, instructions: nil, request_options: {}) ⇒ String

Some parameter documentations has been truncated, see Models::AI::Assistants::InstructionEnhanceParams for more details.

Enhance an assistant’s instructions using an LLM. The endpoint reads the assistant’s current instructions and tools, then streams back improved instructions as they are generated.

Optionally provide an ‘enhancement_prompt` to steer the changes (for example, “make the instructions more concise” or “add error handling guidance”). When omitted, the assistant’s existing instructions are used as the basis for the enhancement.

The enhancement focuses on tool-calling reliability, clarity and precision, completeness and error handling, tool schema alignment, and conversation flow structure.

The response is streamed as ‘text/plain` using chunked transfer encoding; consume the body incrementally to render the enhanced instructions as they arrive.

Parameters:

  • assistant_id (String)

    Unique identifier of the assistant.

  • enhancement_prompt (String, nil)

    Optional guidance describing how the instructions should be enhanced. When provi

  • instructions (String, nil)

    The instructions to enhance. When omitted, the assistant’s existing instructions

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (String)

See Also:



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/telnyx/resources/ai/assistants/instructions.rb', line 42

def enhance(assistant_id, params = {})
  parsed, options = Telnyx::AI::Assistants::InstructionEnhanceParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["ai/assistants/%1$s/instructions/enhance", assistant_id],
    headers: {"accept" => "text/plain"},
    body: parsed,
    model: String,
    options: options
  )
end