Class: Telnyx::Models::AI::AssistantCreateParams::ConversationFlow

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/telnyx/models/ai/assistant_create_params.rb

Defined Under Namespace

Modules: Node Classes: Edge

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(nodes:, start_node_id:, edges: nil) ⇒ Object

Some parameter documentations has been truncated, see Telnyx::Models::AI::AssistantCreateParams::ConversationFlow for more details.

Conversation flow as supplied by API clients (create / update).

A directed graph of ‘FlowNodeReq` connected by `FlowEdge`s. Validation enforces unique node/edge IDs, that `start_node_id` references a real node, and that every edge’s endpoints reference real nodes.

Parameters:



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
# File 'lib/telnyx/models/ai/assistant_create_params.rb', line 276

class ConversationFlow < Telnyx::Internal::Type::BaseModel
  # @!attribute nodes
  #   All nodes in the flow. Must contain `start_node_id`. Each node is a prompt node
  #   (`type: prompt`) or a tool node (`type: tool`).
  #
  #   @return [Array<Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Prompt, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Tool>]
  required :nodes,
           -> { Telnyx::Internal::Type::ArrayOf[union: Telnyx::AI::AssistantCreateParams::ConversationFlow::Node] }

  # @!attribute start_node_id
  #   ID of the node where the conversation begins.
  #
  #   @return [String]
  required :start_node_id, String

  # @!attribute edges
  #   Directed transitions between nodes. May be empty for a single-node flow.
  #
  #   @return [Array<Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge>, nil]
  optional :edges,
           -> { Telnyx::Internal::Type::ArrayOf[Telnyx::AI::AssistantCreateParams::ConversationFlow::Edge] }

  # @!method initialize(nodes:, start_node_id:, edges: nil)
  #   Some parameter documentations has been truncated, see
  #   {Telnyx::Models::AI::AssistantCreateParams::ConversationFlow} for more details.
  #
  #   Conversation flow as supplied by API clients (create / update).
  #
  #   A directed graph of `FlowNodeReq` connected by `FlowEdge`s. Validation enforces
  #   unique node/edge IDs, that `start_node_id` references a real node, and that
  #   every edge's endpoints reference real nodes.
  #
  #   @param nodes [Array<Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Prompt, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Tool>] All nodes in the flow. Must contain `start_node_id`. Each node is a prompt node
  #
  #   @param start_node_id [String] ID of the node where the conversation begins.
  #
  #   @param edges [Array<Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge>] Directed transitions between nodes. May be empty for a single-node flow.

  # One step in a conversation flow, as supplied by API clients.
  #
  # Each node carries the prompt, tool scope, and optional overrides for
  # model/voice/transcription. Unset overrides cascade from the assistant.
  module Node
    extend Telnyx::Internal::Type::Union

    discriminator :type

    # One step in a conversation flow, as supplied by API clients.
    #
    # Each node carries the prompt, tool scope, and optional overrides for
    # model/voice/transcription. Unset overrides cascade from the assistant.
    variant :prompt, -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Node::Prompt }

    # A standalone tool step in a conversation flow, as supplied by clients.
    #
    # Unlike a prompt node, a tool node has no instructions or model — it
    # isn't an LLM turn. Reaching it deterministically runs one shared tool
    # (arguments filled from matching dynamic variables by name), then routes
    # on the result via outgoing `tool_result` edges.
    variant :tool, -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Node::Tool }

    class Prompt < Telnyx::Internal::Type::BaseModel
      # @!attribute id
      #   Caller-supplied unique identifier for this node within the flow.
      #
      #   @return [String]
      required :id, String

      # @!attribute instructions
      #   Prompt that drives the LLM while this node is active. Required.
      #
      #   @return [String]
      required :instructions, String

      # @!attribute external_llm
      #   Override for `Assistant.external_llm` while this node is active. Use this to
      #   route a node's turns to a different external LLM (different `model`, `base_url`,
      #   credentials). Part of the LLM bundle — see `model` for cascade semantics.
      #   Mutually exclusive with `model` on the node (a single LLM identity per node).
      #
      #   @return [Telnyx::Models::AI::ExternalLlmReq, nil]
      optional :external_llm, -> { Telnyx::AI::ExternalLlmReq }

      # @!attribute instructions_mode
      #   How `instructions` combine with the assistant-level instructions. `replace`
      #   (default): the node's instructions are used alone. `append`: the node's
      #   instructions are concatenated after the assistant's instructions.
      #
      #   @return [Symbol, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Prompt::InstructionsMode, nil]
      optional :instructions_mode,
               enum: -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Node::Prompt::InstructionsMode }

      # @!attribute llm_api_key_ref
      #   Override for `Assistant.llm_api_key_ref` while this node is active. Part of the
      #   LLM bundle — see `model` for cascade semantics.
      #
      #   @return [String, nil]
      optional :llm_api_key_ref, String

      # @!attribute model
      #   Override for `Assistant.model` while this node is active. Part of the LLM bundle
      #   (`model` + `llm_api_key_ref` + `external_llm`): when any of the three is set on
      #   the node, all three are taken from the node and the assistant-level LLM identity
      #   is not consulted. When none of the three is set, the assistant's bundle cascades
      #   unchanged.
      #
      #   @return [String, nil]
      optional :model, String

      # @!attribute name
      #   Optional human-readable label, displayed in authoring UIs.
      #
      #   @return [String, nil]
      optional :name, String

      # @!attribute position
      #   Optional canvas coordinates used by authoring UIs to lay out the graph. Ignored
      #   by the runtime; round-trips so frontends can persist graph layout across
      #   reloads.
      #
      #   @return [Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Prompt::Position, nil]
      optional :position, -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Node::Prompt::Position }

      # @!attribute shared_tool_ids
      #   IDs of shared (org-level) tools available at this node. Knowledge bases are
      #   attached the same way — via a shared retrieval tool. Tools not listed here are
      #   not callable while this node is active.
      #
      #   @return [Array<String>, nil]
      optional :shared_tool_ids, Telnyx::Internal::Type::ArrayOf[String]

      # @!attribute tools_mode
      #   How `shared_tool_ids` combine with the assistant-level tool set. `replace`
      #   (default): only the node's tools are callable. `append`: the node's tools are
      #   added to the assistant's tools. Ignored when `shared_tool_ids` is null.
      #
      #   @return [Symbol, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Prompt::ToolsMode, nil]
      optional :tools_mode,
               enum: -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Node::Prompt::ToolsMode }

      # @!attribute transcription
      #   Per-node transcription override (model/language/region). Unset fields cascade
      #   from the assistant-level transcription.
      #
      #   @return [Telnyx::Models::AI::TranscriptionSettings, nil]
      optional :transcription, -> { Telnyx::AI::TranscriptionSettings }

      # @!attribute type
      #   Node kind discriminator. `prompt` (default) is an LLM-driven step; `tool` is a
      #   standalone tool execution (see `ToolNodeReq`).
      #
      #   @return [Symbol, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Prompt::Type, nil]
      optional :type, enum: -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Node::Prompt::Type }

      # @!attribute voice_settings
      #   Per-node voice override. Only fields set here override the assistant-level voice
      #   settings; unset fields cascade.
      #
      #   @return [Telnyx::Models::AI::VoiceSettings, nil]
      optional :voice_settings, -> { Telnyx::AI::VoiceSettings }

      # @!method initialize(id:, instructions:, external_llm: nil, instructions_mode: nil, llm_api_key_ref: nil, model: nil, name: nil, position: nil, shared_tool_ids: nil, tools_mode: nil, transcription: nil, type: nil, voice_settings: nil)
      #   Some parameter documentations has been truncated, see
      #   {Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Prompt} for
      #   more details.
      #
      #   One step in a conversation flow, as supplied by API clients.
      #
      #   Each node carries the prompt, tool scope, and optional overrides for
      #   model/voice/transcription. Unset overrides cascade from the assistant.
      #
      #   @param id [String] Caller-supplied unique identifier for this node within the flow.
      #
      #   @param instructions [String] Prompt that drives the LLM while this node is active. Required.
      #
      #   @param external_llm [Telnyx::Models::AI::ExternalLlmReq] Override for `Assistant.external_llm` while this node is active. Use this to rou
      #
      #   @param instructions_mode [Symbol, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Prompt::InstructionsMode] How `instructions` combine with the assistant-level instructions. `replace` (def
      #
      #   @param llm_api_key_ref [String] Override for `Assistant.llm_api_key_ref` while this node is active. Part of the
      #
      #   @param model [String] Override for `Assistant.model` while this node is active. Part of the LLM bundle
      #
      #   @param name [String] Optional human-readable label, displayed in authoring UIs.
      #
      #   @param position [Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Prompt::Position] Optional canvas coordinates used by authoring UIs to lay out the graph. Ignored
      #
      #   @param shared_tool_ids [Array<String>] IDs of shared (org-level) tools available at this node. Knowledge bases are atta
      #
      #   @param tools_mode [Symbol, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Prompt::ToolsMode] How `shared_tool_ids` combine with the assistant-level tool set. `replace` (defa
      #
      #   @param transcription [Telnyx::Models::AI::TranscriptionSettings] Per-node transcription override (model/language/region). Unset fields cascade fr
      #
      #   @param type [Symbol, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Prompt::Type] Node kind discriminator. `prompt` (default) is an LLM-driven step; `tool` is a s
      #
      #   @param voice_settings [Telnyx::Models::AI::VoiceSettings] Per-node voice override. Only fields set here override the assistant-level voice

      # How `instructions` combine with the assistant-level instructions. `replace`
      # (default): the node's instructions are used alone. `append`: the node's
      # instructions are concatenated after the assistant's instructions.
      #
      # @see Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Prompt#instructions_mode
      module InstructionsMode
        extend Telnyx::Internal::Type::Enum

        REPLACE = :replace
        APPEND = :append

        # @!method self.values
        #   @return [Array<Symbol>]
      end

      # @see Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Prompt#position
      class Position < Telnyx::Internal::Type::BaseModel
        # @!attribute x
        #   Horizontal coordinate in the authoring canvas.
        #
        #   @return [Float]
        required :x, Float

        # @!attribute y_
        #   Vertical coordinate in the authoring canvas.
        #
        #   @return [Float]
        required :y_, Float, api_name: :y

        # @!method initialize(x:, y_:)
        #   Optional canvas coordinates used by authoring UIs to lay out the graph. Ignored
        #   by the runtime; round-trips so frontends can persist graph layout across
        #   reloads.
        #
        #   @param x [Float] Horizontal coordinate in the authoring canvas.
        #
        #   @param y_ [Float] Vertical coordinate in the authoring canvas.
      end

      # How `shared_tool_ids` combine with the assistant-level tool set. `replace`
      # (default): only the node's tools are callable. `append`: the node's tools are
      # added to the assistant's tools. Ignored when `shared_tool_ids` is null.
      #
      # @see Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Prompt#tools_mode
      module ToolsMode
        extend Telnyx::Internal::Type::Enum

        REPLACE = :replace
        APPEND = :append

        # @!method self.values
        #   @return [Array<Symbol>]
      end

      # Node kind discriminator. `prompt` (default) is an LLM-driven step; `tool` is a
      # standalone tool execution (see `ToolNodeReq`).
      #
      # @see Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Prompt#type
      module Type
        extend Telnyx::Internal::Type::Enum

        PROMPT = :prompt

        # @!method self.values
        #   @return [Array<Symbol>]
      end
    end

    class Tool < Telnyx::Internal::Type::BaseModel
      # @!attribute id
      #   Caller-supplied unique identifier for this node within the flow.
      #
      #   @return [String]
      required :id, String

      # @!attribute shared_tool_id
      #   ID of the single shared (org-level) tool this node executes. When the flow
      #   reaches this node the tool runs as a deliberate step (no LLM turn); its outgoing
      #   `tool_result` edges then route on the outcome. Arguments are filled from the
      #   conversation's dynamic variables by name — a dynamic variable whose name matches
      #   one of the tool's parameters supplies that argument. Cross-validated against the
      #   org's shared tools on write.
      #
      #   @return [String]
      required :shared_tool_id, String

      # @!attribute name
      #   Optional human-readable label, displayed in authoring UIs.
      #
      #   @return [String, nil]
      optional :name, String

      # @!attribute position
      #   Optional canvas coordinates used by authoring UIs to lay out the graph. Ignored
      #   by the runtime; round-trips so frontends can persist graph layout across
      #   reloads.
      #
      #   @return [Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Tool::Position, nil]
      optional :position, -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Node::Tool::Position }

      # @!attribute type
      #   Node kind discriminator. Always `tool` for a tool node.
      #
      #   @return [Symbol, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Tool::Type, nil]
      optional :type, enum: -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Node::Tool::Type }

      # @!method initialize(id:, shared_tool_id:, name: nil, position: nil, type: nil)
      #   Some parameter documentations has been truncated, see
      #   {Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Tool} for
      #   more details.
      #
      #   A standalone tool step in a conversation flow, as supplied by clients.
      #
      #   Unlike a prompt node, a tool node has no instructions or model — it isn't an LLM
      #   turn. Reaching it deterministically runs one shared tool (arguments filled from
      #   matching dynamic variables by name), then routes on the result via outgoing
      #   `tool_result` edges.
      #
      #   @param id [String] Caller-supplied unique identifier for this node within the flow.
      #
      #   @param shared_tool_id [String] ID of the single shared (org-level) tool this node executes. When the flow reach
      #
      #   @param name [String] Optional human-readable label, displayed in authoring UIs.
      #
      #   @param position [Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Tool::Position] Optional canvas coordinates used by authoring UIs to lay out the graph. Ignored
      #
      #   @param type [Symbol, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Tool::Type] Node kind discriminator. Always `tool` for a tool node.

      # @see Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Tool#position
      class Position < Telnyx::Internal::Type::BaseModel
        # @!attribute x
        #   Horizontal coordinate in the authoring canvas.
        #
        #   @return [Float]
        required :x, Float

        # @!attribute y_
        #   Vertical coordinate in the authoring canvas.
        #
        #   @return [Float]
        required :y_, Float, api_name: :y

        # @!method initialize(x:, y_:)
        #   Optional canvas coordinates used by authoring UIs to lay out the graph. Ignored
        #   by the runtime; round-trips so frontends can persist graph layout across
        #   reloads.
        #
        #   @param x [Float] Horizontal coordinate in the authoring canvas.
        #
        #   @param y_ [Float] Vertical coordinate in the authoring canvas.
      end

      # Node kind discriminator. Always `tool` for a tool node.
      #
      # @see Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Tool#type
      module Type
        extend Telnyx::Internal::Type::Enum

        TOOL = :tool

        # @!method self.values
        #   @return [Array<Symbol>]
      end
    end

    # @!method self.variants
    #   @return [Array(Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Prompt, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Tool)]
  end

  class Edge < Telnyx::Internal::Type::BaseModel
    # @!attribute id
    #   Caller-supplied unique identifier for this edge within the flow.
    #
    #   @return [String]
    required :id, String

    # @!attribute condition
    #   Condition that gates the transition. Discriminated by `type`: `llm`,
    #   `expression`.
    #
    #   @return [Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Llm, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression]
    required :condition, union: -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Edge::Condition }

    # @!attribute start_node_id
    #   ID of the node this edge transitions away from.
    #
    #   @return [String]
    required :start_node_id, String

    # @!attribute target
    #   Destination of the transition. Discriminated by `type`: `node` (jump to another
    #   node in this flow) or `assistant` (hand off to a different assistant).
    #
    #   @return [Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Target::Node, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Target::Assistant]
    required :target, union: -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Edge::Target }

    # @!method initialize(id:, condition:, start_node_id:, target:)
    #   Some parameter documentations has been truncated, see
    #   {Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge} for more
    #   details.
    #
    #   Directed transition from one node to a target, gated by a condition.
    #
    #   The target is either another node in the same flow (`NodeTarget`) or a different
    #   assistant (`AssistantTarget`). Multiple edges may share a `start_node_id`; the
    #   runtime evaluates them in the order they're declared and takes the first whose
    #   condition is true.
    #
    #   @param id [String] Caller-supplied unique identifier for this edge within the flow.
    #
    #   @param condition [Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Llm, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression] Condition that gates the transition. Discriminated by `type`: `llm`, `expression
    #
    #   @param start_node_id [String] ID of the node this edge transitions away from.
    #
    #   @param target [Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Target::Node, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Target::Assistant] Destination of the transition. Discriminated by `type`: `node` (jump to another

    # Condition that gates the transition. Discriminated by `type`: `llm`,
    # `expression`.
    #
    # @see Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge#condition
    module Condition
      extend Telnyx::Internal::Type::Union

      discriminator :type

      # Edge condition evaluated by the LLM from a natural-language prompt.
      #
      # The model is asked to judge the prompt against conversation context and
      # returns true/false. Use this for fuzzy intents that aren't expressible as
      # a deterministic expression (e.g. 'user wants to escalate to a human').
      variant :llm, -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Llm }

      # Edge condition evaluated as a deterministic expression AST.
      #
      # The expression is computed against runtime dynamic variables and must
      # evaluate to a boolean. Prefer this over `LLMCondition` when the rule is
      # a clean function of known variables — it's cheaper and predictable.
      variant :expression,
              -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression }

      class Llm < Telnyx::Internal::Type::BaseModel
        # @!attribute prompt
        #   Natural-language criterion the LLM judges as true/false.
        #
        #   @return [String]
        required :prompt, String

        # @!attribute type
        #
        #   @return [Symbol, :llm]
        required :type, const: :llm

        # @!method initialize(prompt:, type: :llm)
        #   Edge condition evaluated by the LLM from a natural-language prompt.
        #
        #   The model is asked to judge the prompt against conversation context and returns
        #   true/false. Use this for fuzzy intents that aren't expressible as a
        #   deterministic expression (e.g. 'user wants to escalate to a human').
        #
        #   @param prompt [String] Natural-language criterion the LLM judges as true/false.
        #
        #   @param type [Symbol, :llm]
      end

      class Expression < Telnyx::Internal::Type::BaseModel
        # @!attribute expression
        #   A node in a deterministic expression AST. Exactly one variant is selected by the
        #   `type` discriminator. Terminal variants (`number_literal`, `string_literal`,
        #   `bool_literal`, `variable`) bottom out the recursion; `arithmetic`, `bool_op`,
        #   and `comparison` nest further sub-expressions.
        #
        #   Extracted into a single named schema so the recursive union is defined once (was
        #   previously inlined at every operand site).
        #
        #   @return [Object, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression::Expression::DynamicVariableExpression, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression::Expression::StringLiteralExpression, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression::Expression::NumberLiteralExpression, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression::Expression::BooleanLiteralExpression]
        required :expression,
                 union: -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression::Expression }

        # @!attribute type
        #
        #   @return [Symbol, :expression]
        required :type, const: :expression

        # @!method initialize(expression:, type: :expression)
        #   Some parameter documentations has been truncated, see
        #   {Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression}
        #   for more details.
        #
        #   Edge condition evaluated as a deterministic expression AST.
        #
        #   The expression is computed against runtime dynamic variables and must evaluate
        #   to a boolean. Prefer this over `LLMCondition` when the rule is a clean function
        #   of known variables — it's cheaper and predictable.
        #
        #   @param expression [Object, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression::Expression::DynamicVariableExpression, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression::Expression::StringLiteralExpression, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression::Expression::NumberLiteralExpression, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression::Expression::BooleanLiteralExpression] A node in a deterministic expression AST. Exactly one variant is selected by the
        #
        #   @param type [Symbol, :expression]

        # A node in a deterministic expression AST. Exactly one variant is selected by the
        # `type` discriminator. Terminal variants (`number_literal`, `string_literal`,
        # `bool_literal`, `variable`) bottom out the recursion; `arithmetic`, `bool_op`,
        # and `comparison` nest further sub-expressions.
        #
        # Extracted into a single named schema so the recursive union is defined once (was
        # previously inlined at every operand site).
        #
        # @see Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression#expression
        module Expression
          extend Telnyx::Internal::Type::Union

          variant Telnyx::Internal::Type::Unknown

          # Reference a dynamic variable by name.
          #
          # Resolved at runtime from the assistant's dynamic-variables context (see
          # `Assistant.dynamic_variables` and the dynamic-variables webhook).
          variant -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression::Expression::DynamicVariableExpression }

          # Constant string value.
          variant -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression::Expression::StringLiteralExpression }

          # Constant numeric value (float; integers are accepted and stored as float).
          variant -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression::Expression::NumberLiteralExpression }

          # Constant boolean value. Useful for unconditional ('always') edges.
          variant -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression::Expression::BooleanLiteralExpression }

          class DynamicVariableExpression < Telnyx::Internal::Type::BaseModel
            # @!attribute name
            #   Variable name to look up in the runtime context.
            #
            #   @return [String]
            required :name, String

            # @!attribute type
            #
            #   @return [Symbol, :variable]
            required :type, const: :variable

            # @!method initialize(name:, type: :variable)
            #   Reference a dynamic variable by name.
            #
            #   Resolved at runtime from the assistant's dynamic-variables context (see
            #   `Assistant.dynamic_variables` and the dynamic-variables webhook).
            #
            #   @param name [String] Variable name to look up in the runtime context.
            #
            #   @param type [Symbol, :variable]
          end

          class StringLiteralExpression < Telnyx::Internal::Type::BaseModel
            # @!attribute type
            #
            #   @return [Symbol, :string_literal]
            required :type, const: :string_literal

            # @!attribute value
            #   Literal string value.
            #
            #   @return [String]
            required :value, String

            # @!method initialize(value:, type: :string_literal)
            #   Constant string value.
            #
            #   @param value [String] Literal string value.
            #
            #   @param type [Symbol, :string_literal]
          end

          class NumberLiteralExpression < Telnyx::Internal::Type::BaseModel
            # @!attribute type
            #
            #   @return [Symbol, :number_literal]
            required :type, const: :number_literal

            # @!attribute value
            #   Literal numeric value.
            #
            #   @return [Float]
            required :value, Float

            # @!method initialize(value:, type: :number_literal)
            #   Constant numeric value (float; integers are accepted and stored as float).
            #
            #   @param value [Float] Literal numeric value.
            #
            #   @param type [Symbol, :number_literal]
          end

          class BooleanLiteralExpression < Telnyx::Internal::Type::BaseModel
            # @!attribute type
            #
            #   @return [Symbol, :bool_literal]
            required :type, const: :bool_literal

            # @!attribute value
            #   Literal boolean value.
            #
            #   @return [Boolean]
            required :value, Telnyx::Internal::Type::Boolean

            # @!method initialize(value:, type: :bool_literal)
            #   Constant boolean value. Useful for unconditional ('always') edges.
            #
            #   @param value [Boolean] Literal boolean value.
            #
            #   @param type [Symbol, :bool_literal]
          end

          # @!method self.variants
          #   @return [Array(Object, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression::Expression::DynamicVariableExpression, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression::Expression::StringLiteralExpression, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression::Expression::NumberLiteralExpression, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression::Expression::BooleanLiteralExpression)]
        end
      end

      # @!method self.variants
      #   @return [Array(Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Llm, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Condition::Expression)]
    end

    # Destination of the transition. Discriminated by `type`: `node` (jump to another
    # node in this flow) or `assistant` (hand off to a different assistant).
    #
    # @see Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge#target
    module Target
      extend Telnyx::Internal::Type::Union

      discriminator :type

      # Edge target referencing another node within the same flow.
      #
      # The runtime transitions the active node to `node_id` and continues
      # processing within the current assistant's flow.
      variant :node, -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Edge::Target::Node }

      # Edge target referencing a different assistant.
      #
      # When the edge fires, the conversation hands off to `assistant_id`: the
      # active assistant on the conversation row is rewritten and the new
      # assistant's flow starts at its own `start_node_id`. The current turn's
      # LLM response is delivered to the user as-is; subsequent turns route
      # to the new assistant.
      variant :assistant, -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Edge::Target::Assistant }

      class Node < Telnyx::Internal::Type::BaseModel
        # @!attribute node_id
        #   ID of the node this edge transitions into.
        #
        #   @return [String]
        required :node_id, String

        # @!attribute type
        #
        #   @return [Symbol, :node]
        required :type, const: :node

        # @!method initialize(node_id:, type: :node)
        #   Edge target referencing another node within the same flow.
        #
        #   The runtime transitions the active node to `node_id` and continues processing
        #   within the current assistant's flow.
        #
        #   @param node_id [String] ID of the node this edge transitions into.
        #
        #   @param type [Symbol, :node]
      end

      class Assistant < Telnyx::Internal::Type::BaseModel
        # @!attribute assistant_id
        #   ID of the assistant the conversation transitions to.
        #
        #   @return [String]
        required :assistant_id, String

        # @!attribute type
        #
        #   @return [Symbol, :assistant]
        required :type, const: :assistant

        # @!attribute position
        #   Optional canvas coordinates for rendering the target assistant as a node in
        #   authoring UIs. Pure presentation — the runtime ignores it; round-trips so
        #   frontends can persist graph layout across reloads. When multiple edges target
        #   the same assistant, each edge's `position` is independent (frontends typically
        #   use the first non-null one).
        #
        #   @return [Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Target::Assistant::Position, nil]
        optional :position,
                 -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Edge::Target::Assistant::Position }

        # @!attribute voice_mode
        #   Voice behavior when handing off to the target assistant, mirroring the handoff
        #   tool's `voice_mode`. `unified` (default) keeps the current voice across the
        #   handoff; `distinct` lets the target assistant speak with its own configured
        #   voice. Only applies to assistant targets — node targets override voice via the
        #   node's own `voice_settings`.
        #
        #   @return [Symbol, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Target::Assistant::VoiceMode, nil]
        optional :voice_mode,
                 enum: -> { Telnyx::AI::AssistantCreateParams::ConversationFlow::Edge::Target::Assistant::VoiceMode }

        # @!method initialize(assistant_id:, position: nil, voice_mode: nil, type: :assistant)
        #   Some parameter documentations has been truncated, see
        #   {Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Target::Assistant}
        #   for more details.
        #
        #   Edge target referencing a different assistant.
        #
        #   When the edge fires, the conversation hands off to `assistant_id`: the active
        #   assistant on the conversation row is rewritten and the new assistant's flow
        #   starts at its own `start_node_id`. The current turn's LLM response is delivered
        #   to the user as-is; subsequent turns route to the new assistant.
        #
        #   @param assistant_id [String] ID of the assistant the conversation transitions to.
        #
        #   @param position [Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Target::Assistant::Position] Optional canvas coordinates for rendering the target assistant as a node in auth
        #
        #   @param voice_mode [Symbol, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Target::Assistant::VoiceMode] Voice behavior when handing off to the target assistant, mirroring the handoff t
        #
        #   @param type [Symbol, :assistant]

        # @see Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Target::Assistant#position
        class Position < Telnyx::Internal::Type::BaseModel
          # @!attribute x
          #   Horizontal coordinate in the authoring canvas.
          #
          #   @return [Float]
          required :x, Float

          # @!attribute y_
          #   Vertical coordinate in the authoring canvas.
          #
          #   @return [Float]
          required :y_, Float, api_name: :y

          # @!method initialize(x:, y_:)
          #   Optional canvas coordinates for rendering the target assistant as a node in
          #   authoring UIs. Pure presentation — the runtime ignores it; round-trips so
          #   frontends can persist graph layout across reloads. When multiple edges target
          #   the same assistant, each edge's `position` is independent (frontends typically
          #   use the first non-null one).
          #
          #   @param x [Float] Horizontal coordinate in the authoring canvas.
          #
          #   @param y_ [Float] Vertical coordinate in the authoring canvas.
        end

        # Voice behavior when handing off to the target assistant, mirroring the handoff
        # tool's `voice_mode`. `unified` (default) keeps the current voice across the
        # handoff; `distinct` lets the target assistant speak with its own configured
        # voice. Only applies to assistant targets — node targets override voice via the
        # node's own `voice_settings`.
        #
        # @see Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Target::Assistant#voice_mode
        module VoiceMode
          extend Telnyx::Internal::Type::Enum

          UNIFIED = :unified
          DISTINCT = :distinct

          # @!method self.values
          #   @return [Array<Symbol>]
        end
      end

      # @!method self.variants
      #   @return [Array(Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Target::Node, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge::Target::Assistant)]
    end
  end
end

Instance Attribute Details

#edgesArray<Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Edge>?

Directed transitions between nodes. May be empty for a single-node flow.



295
296
# File 'lib/telnyx/models/ai/assistant_create_params.rb', line 295

optional :edges,
-> { Telnyx::Internal::Type::ArrayOf[Telnyx::AI::AssistantCreateParams::ConversationFlow::Edge] }

#nodesArray<Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Prompt, Telnyx::Models::AI::AssistantCreateParams::ConversationFlow::Node::Tool>

All nodes in the flow. Must contain ‘start_node_id`. Each node is a prompt node (`type: prompt`) or a tool node (`type: tool`).



282
283
# File 'lib/telnyx/models/ai/assistant_create_params.rb', line 282

required :nodes,
-> { Telnyx::Internal::Type::ArrayOf[union: Telnyx::AI::AssistantCreateParams::ConversationFlow::Node] }

#start_node_idString

ID of the node where the conversation begins.

Returns:

  • (String)


289
# File 'lib/telnyx/models/ai/assistant_create_params.rb', line 289

required :start_node_id, String

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/telnyx/models/ai/assistant_create_params.rb', line 633