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

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:



165
166
167
168
169
# File 'lib/telnyx/resources/ai/assistants/tests.rb', line 165

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)



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

def runs
  @runs
end

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



9
10
11
# File 'lib/telnyx/resources/ai/assistants/tests.rb', line 9

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:



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

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:



153
154
155
156
157
158
159
160
# File 'lib/telnyx/resources/ai/assistants/tests.rb', line 153

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:



131
132
133
134
135
136
137
138
139
140
141
# File 'lib/telnyx/resources/ai/assistants/tests.rb', line 131

def list(params = {})
  parsed, options = Telnyx::AI::Assistants::TestListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "ai/assistants/tests",
    query: parsed.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:



64
65
66
67
68
69
70
71
# File 'lib/telnyx/resources/ai/assistants/tests.rb', line 64

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:



100
101
102
103
104
105
106
107
108
109
# File 'lib/telnyx/resources/ai/assistants/tests.rb', line 100

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