Class: Telnyx::Resources::AI::Missions::Tools

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/ai/missions/tools.rb,
sig/telnyx/resources/ai/missions/tools.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Tools

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

Parameters:



135
136
137
# File 'lib/telnyx/resources/ai/missions/tools.rb', line 135

def initialize(client:)
  @client = client
end

Instance Method Details

#create_tool(mission_id, request_options: {}) ⇒ Object

Adds a new tool to the specified mission, defining an action agents can invoke during runs of this mission.

Parameters:

  • mission_id (String)

    Unique identifier of the mission.

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

Returns:

  • (Object)

See Also:



20
21
22
23
24
25
26
27
# File 'lib/telnyx/resources/ai/missions/tools.rb', line 20

def create_tool(mission_id, params = {})
  @client.request(
    method: :post,
    path: ["ai/missions/%1$s/tools", mission_id],
    model: Telnyx::Internal::Type::Unknown,
    options: params[:request_options]
  )
end

#delete_tool(tool_id, mission_id:, request_options: {}) ⇒ nil

Removes the specified tool from the mission so agents can no longer invoke it in subsequent runs.

Parameters:

  • tool_id (String)

    Unique identifier of the tool.

  • mission_id (String)

    Unique identifier of the mission.

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

Returns:

  • (nil)

See Also:



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/telnyx/resources/ai/missions/tools.rb', line 43

def delete_tool(tool_id, params)
  parsed, options = Telnyx::AI::Missions::ToolDeleteToolParams.dump_request(params)
  mission_id =
    parsed.delete(:mission_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["ai/missions/%1$s/tools/%2$s", mission_id, tool_id],
    model: NilClass,
    options: options
  )
end

#get_tool(tool_id, mission_id:, request_options: {}) ⇒ Object

Returns the definition of a single tool configured on the specified mission.

Parameters:

  • tool_id (String)

    Unique identifier of the tool.

  • mission_id (String)

    Unique identifier of the mission.

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

Returns:

  • (Object)

See Also:



70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/telnyx/resources/ai/missions/tools.rb', line 70

def get_tool(tool_id, params)
  parsed, options = Telnyx::AI::Missions::ToolGetToolParams.dump_request(params)
  mission_id =
    parsed.delete(:mission_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["ai/missions/%1$s/tools/%2$s", mission_id, tool_id],
    model: Telnyx::Internal::Type::Unknown,
    options: options
  )
end

#list_tools(mission_id, request_options: {}) ⇒ Object

Returns the tools configured on the specified mission. Tools define the actions agents may invoke while executing the mission's runs.

Parameters:

  • mission_id (String)

    Unique identifier of the mission.

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

Returns:

  • (Object)

See Also:



96
97
98
99
100
101
102
103
# File 'lib/telnyx/resources/ai/missions/tools.rb', line 96

def list_tools(mission_id, params = {})
  @client.request(
    method: :get,
    path: ["ai/missions/%1$s/tools", mission_id],
    model: Telnyx::Internal::Type::Unknown,
    options: params[:request_options]
  )
end

#update_tool(tool_id, mission_id:, request_options: {}) ⇒ Object

Replaces the definition of the specified tool on this mission.

Parameters:

  • tool_id (String)

    Unique identifier of the tool.

  • mission_id (String)

    Unique identifier of the mission.

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

Returns:

  • (Object)

See Also:



118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/telnyx/resources/ai/missions/tools.rb', line 118

def update_tool(tool_id, params)
  parsed, options = Telnyx::AI::Missions::ToolUpdateToolParams.dump_request(params)
  mission_id =
    parsed.delete(:mission_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :put,
    path: ["ai/missions/%1$s/tools/%2$s", mission_id, tool_id],
    model: Telnyx::Internal::Type::Unknown,
    options: options
  )
end