Class: Telnyx::Resources::AI::Assistants::Tests

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/ai/assistants/tests.rb,
lib/telnyx/resources/ai/assistants/tests/runs.rb,
lib/telnyx/resources/ai/assistants/tests/test_suites.rb,
lib/telnyx/resources/ai/assistants/tests/test_suites/runs.rb

Overview

Configure AI assistant specifications

Defined Under Namespace

Classes: Runs, TestSuites

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Tests

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 Tests.

Parameters:



169
170
171
172
173
# File 'lib/telnyx/resources/ai/assistants/tests.rb', line 169

def initialize(client:)
  @client = client
  @test_suites = Telnyx::Resources::AI::Assistants::Tests::TestSuites.new(client: client)
  @runs = Telnyx::Resources::AI::Assistants::Tests::Runs.new(client: client)
end

Instance Attribute Details

#runsTelnyx::Resources::AI::Assistants::Tests::Runs (readonly)

Configure AI assistant specifications



15
16
17
# File 'lib/telnyx/resources/ai/assistants/tests.rb', line 15

def runs
  @runs
end

#test_suitesTelnyx::Resources::AI::Assistants::Tests::TestSuites (readonly)

Configure AI assistant specifications



11
12
13
# File 'lib/telnyx/resources/ai/assistants/tests.rb', line 11

def test_suites
  @test_suites
end

Instance Method Details

#create(destination:, instructions:, name:, rubric:, description: nil, max_duration_seconds: nil, telnyx_conversation_channel: nil, test_suite: nil, request_options: {}) ⇒ Telnyx::Models::AI::Assistants::AssistantTest

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

Creates a comprehensive test configuration for evaluating AI assistant performance

Parameters:

  • destination (String)

    The target destination for the test conversation. Format depends on the channel:

  • instructions (String)

    Detailed instructions that define the test scenario and what the assistant shoul

  • name (String)

    A descriptive name for the assistant test. This will be used to identify the tes

  • rubric (Array<Telnyx::Models::AI::Assistants::TestCreateParams::Rubric>)

    Evaluation criteria used to assess the assistant’s performance. Each rubric item

  • description (String)

    Optional detailed description of what this test evaluates and its purpose. Helps

  • max_duration_seconds (Integer)

    Maximum duration in seconds that the test conversation should run before timing

  • telnyx_conversation_channel (Symbol, Telnyx::Models::AI::Assistants::TelnyxConversationChannel)

    The communication channel through which the test will be conducted. Determines h

  • test_suite (String)

    Optional test suite name to group related tests together. Useful for organizing

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

Returns:

See Also:



46
47
48
49
50
51
52
53
54
55
# File 'lib/telnyx/resources/ai/assistants/tests.rb', line 46

def create(params)
  parsed, options = Telnyx::AI::Assistants::TestCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "ai/assistants/tests",
    body: parsed,
    model: Telnyx::AI::Assistants::AssistantTest,
    options: options
  )
end

#delete(test_id, request_options: {}) ⇒ nil

Permanently removes an assistant test and all associated data

Parameters:

Returns:

  • (nil)

See Also:



157
158
159
160
161
162
163
164
# File 'lib/telnyx/resources/ai/assistants/tests.rb', line 157

def delete(test_id, params = {})
  @client.request(
    method: :delete,
    path: ["ai/assistants/tests/%1$s", test_id],
    model: NilClass,
    options: params[:request_options]
  )
end

#list(destination: nil, page_number: nil, page_size: nil, telnyx_conversation_channel: nil, test_suite: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::AI::Assistants::AssistantTest>

Retrieves a paginated list of assistant tests with optional filtering capabilities

Parameters:

  • destination (String)

    Filter tests by destination (phone number, webhook URL, etc.)

  • page_number (Integer)
  • page_size (Integer)
  • telnyx_conversation_channel (String)

    Filter tests by communication channel (e.g., ‘web_chat’, ‘sms’)

  • test_suite (String)

    Filter tests by test suite name

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

Returns:

See Also:



134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/telnyx/resources/ai/assistants/tests.rb', line 134

def list(params = {})
  parsed, options = Telnyx::AI::Assistants::TestListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "ai/assistants/tests",
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::AI::Assistants::AssistantTest,
    options: options
  )
end

#retrieve(test_id, request_options: {}) ⇒ Telnyx::Models::AI::Assistants::AssistantTest

Retrieves detailed information about a specific assistant test

Parameters:

Returns:

See Also:



67
68
69
70
71
72
73
74
# File 'lib/telnyx/resources/ai/assistants/tests.rb', line 67

def retrieve(test_id, params = {})
  @client.request(
    method: :get,
    path: ["ai/assistants/tests/%1$s", test_id],
    model: Telnyx::AI::Assistants::AssistantTest,
    options: params[:request_options]
  )
end

#update(test_id, description: nil, destination: nil, instructions: nil, max_duration_seconds: nil, name: nil, rubric: nil, telnyx_conversation_channel: nil, test_suite: nil, request_options: {}) ⇒ Telnyx::Models::AI::Assistants::AssistantTest

Updates an existing assistant test configuration with new settings

Parameters:

  • test_id (String)
  • description (String)

    Updated description of the test’s purpose and evaluation criteria.

  • destination (String)

    Updated target destination for test conversations.

  • instructions (String)

    Updated test scenario instructions and objectives.

  • max_duration_seconds (Integer)

    Updated maximum test duration in seconds.

  • name (String)

    Updated name for the assistant test. Must be unique and descriptive.

  • rubric (Array<Telnyx::Models::AI::Assistants::TestUpdateParams::Rubric>)

    Updated evaluation criteria for assessing assistant performance.

  • telnyx_conversation_channel (Symbol, Telnyx::Models::AI::Assistants::TelnyxConversationChannel)

    Updated communication channel for the test execution.

  • test_suite (String)

    Updated test suite assignment for better organization.

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

Returns:

See Also:



103
104
105
106
107
108
109
110
111
112
# File 'lib/telnyx/resources/ai/assistants/tests.rb', line 103

def update(test_id, params = {})
  parsed, options = Telnyx::AI::Assistants::TestUpdateParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["ai/assistants/tests/%1$s", test_id],
    body: parsed,
    model: Telnyx::AI::Assistants::AssistantTest,
    options: options
  )
end