apologist 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.fern/metadata.json +13 -0
- data/.fernignore +2 -0
- data/.rubocop.yml +108 -0
- data/CONTRIBUTING.md +120 -0
- data/README.md +169 -0
- data/Rakefile +20 -0
- data/custom.gemspec.rb +17 -0
- data/lib/Apologist/benchmarks/client.rb +160 -0
- data/lib/Apologist/benchmarks/types/benchmark_run_request.rb +39 -0
- data/lib/Apologist/benchmarks/types/benchmark_run_request_content.rb +16 -0
- data/lib/Apologist/benchmarks/types/benchmark_run_request_reasoning_effort.rb +15 -0
- data/lib/Apologist/benchmarks/types/benchmark_run_request_verbosity.rb +16 -0
- data/lib/Apologist/benchmarks/types/get_benchmark_run_request.rb +13 -0
- data/lib/Apologist/benchmarks/types/get_benchmark_run_response.rb +11 -0
- data/lib/Apologist/benchmarks/types/list_benchmark_runs_request.rb +33 -0
- data/lib/Apologist/benchmarks/types/list_benchmark_runs_response.rb +17 -0
- data/lib/Apologist/channels/client.rb +319 -0
- data/lib/Apologist/channels/types/get_discord_channel_status_request.rb +11 -0
- data/lib/Apologist/channels/types/get_discord_channel_status_response.rb +15 -0
- data/lib/Apologist/channels/types/get_instagram_privacy_policy_request.rb +11 -0
- data/lib/Apologist/channels/types/receive_discord_interaction_request.rb +17 -0
- data/lib/Apologist/channels/types/receive_facebook_message_request.rb +13 -0
- data/lib/Apologist/channels/types/receive_telegram_update_request.rb +13 -0
- data/lib/Apologist/channels/types/receive_twilio_message_request.rb +15 -0
- data/lib/Apologist/channels/types/verify_facebook_webhook_request.rb +17 -0
- data/lib/Apologist/channels/types/verify_facebook_webhook_request_hub_mode.rb +13 -0
- data/lib/Apologist/chat/client.rb +345 -0
- data/lib/Apologist/chat/types/feedback_request.rb +13 -0
- data/lib/Apologist/chat/types/flag_request.rb +13 -0
- data/lib/Apologist/chat/types/get_chat_completion_request.rb +11 -0
- data/lib/Apologist/chat/types/get_chat_completion_response.rb +11 -0
- data/lib/Apologist/chat/types/like_request.rb +13 -0
- data/lib/Apologist/chat/types/list_chat_completions_request.rb +45 -0
- data/lib/Apologist/chat/types/list_chat_completions_response.rb +17 -0
- data/lib/Apologist/chat/types/share_request.rb +17 -0
- data/lib/Apologist/client.rb +71 -0
- data/lib/Apologist/corpus/client.rb +244 -0
- data/lib/Apologist/corpus/types/corpus_search_request.rb +17 -0
- data/lib/Apologist/corpus/types/corpus_search_request_filters.rb +25 -0
- data/lib/Apologist/corpus/types/impression_request.rb +17 -0
- data/lib/Apologist/corpus/types/log_corpus_referral_redirect_request.rb +19 -0
- data/lib/Apologist/corpus/types/referral_request.rb +17 -0
- data/lib/Apologist/corpus/types/search_corpus_response.rb +11 -0
- data/lib/Apologist/corpus/types/view_request.rb +17 -0
- data/lib/Apologist/ct_as/client.rb +98 -0
- data/lib/Apologist/ct_as/types/cta_click_request.rb +13 -0
- data/lib/Apologist/ct_as/types/match_ctas_response.rb +11 -0
- data/lib/Apologist/environment.rb +7 -0
- data/lib/Apologist/errors/api_error.rb +8 -0
- data/lib/Apologist/errors/client_error.rb +17 -0
- data/lib/Apologist/errors/redirect_error.rb +8 -0
- data/lib/Apologist/errors/response_error.rb +42 -0
- data/lib/Apologist/errors/server_error.rb +11 -0
- data/lib/Apologist/errors/timeout_error.rb +8 -0
- data/lib/Apologist/evaluators/client.rb +164 -0
- data/lib/Apologist/evaluators/types/evaluate_content_response.rb +11 -0
- data/lib/Apologist/evaluators/types/evaluator_request.rb +31 -0
- data/lib/Apologist/evaluators/types/evaluator_request_content.rb +15 -0
- data/lib/Apologist/evaluators/types/evaluator_request_reasoning_effort.rb +15 -0
- data/lib/Apologist/evaluators/types/evaluator_request_verbosity.rb +16 -0
- data/lib/Apologist/evaluators/types/get_evaluation_request.rb +13 -0
- data/lib/Apologist/evaluators/types/get_evaluation_response.rb +11 -0
- data/lib/Apologist/evaluators/types/list_evaluations_request.rb +35 -0
- data/lib/Apologist/evaluators/types/list_evaluations_response.rb +17 -0
- data/lib/Apologist/internal/errors/constraint_error.rb +10 -0
- data/lib/Apologist/internal/errors/type_error.rb +10 -0
- data/lib/Apologist/internal/http/base_request.rb +51 -0
- data/lib/Apologist/internal/http/raw_client.rb +252 -0
- data/lib/Apologist/internal/iterators/cursor_item_iterator.rb +28 -0
- data/lib/Apologist/internal/iterators/cursor_page_iterator.rb +63 -0
- data/lib/Apologist/internal/iterators/item_iterator.rb +65 -0
- data/lib/Apologist/internal/iterators/offset_item_iterator.rb +30 -0
- data/lib/Apologist/internal/iterators/offset_page_iterator.rb +103 -0
- data/lib/Apologist/internal/json/request.rb +41 -0
- data/lib/Apologist/internal/json/serializable.rb +25 -0
- data/lib/Apologist/internal/multipart/multipart_encoder.rb +141 -0
- data/lib/Apologist/internal/multipart/multipart_form_data.rb +78 -0
- data/lib/Apologist/internal/multipart/multipart_form_data_part.rb +51 -0
- data/lib/Apologist/internal/multipart/multipart_request.rb +40 -0
- data/lib/Apologist/internal/types/array.rb +47 -0
- data/lib/Apologist/internal/types/boolean.rb +34 -0
- data/lib/Apologist/internal/types/enum.rb +56 -0
- data/lib/Apologist/internal/types/hash.rb +36 -0
- data/lib/Apologist/internal/types/model/field.rb +38 -0
- data/lib/Apologist/internal/types/model.rb +208 -0
- data/lib/Apologist/internal/types/type.rb +35 -0
- data/lib/Apologist/internal/types/union.rb +161 -0
- data/lib/Apologist/internal/types/unknown.rb +15 -0
- data/lib/Apologist/internal/types/utils.rb +116 -0
- data/lib/Apologist/internal/url_encoded/request.rb +41 -0
- data/lib/Apologist/shares/client.rb +52 -0
- data/lib/Apologist/shares/types/get_shared_messages_request.rb +11 -0
- data/lib/Apologist/shares/types/get_shared_messages_response.rb +11 -0
- data/lib/Apologist/types/chat_completion_request.rb +11 -0
- data/lib/Apologist/types/chat_completion_request_logprobs.rb +13 -0
- data/lib/Apologist/types/chat_completion_request_metadata.rb +29 -0
- data/lib/Apologist/types/chat_completion_request_reasoning_effort.rb +13 -0
- data/lib/Apologist/types/chat_completion_request_response_format.rb +11 -0
- data/lib/Apologist/types/chat_completion_request_response_format_json_schema.rb +17 -0
- data/lib/Apologist/types/chat_completion_request_response_format_type.rb +15 -0
- data/lib/Apologist/types/chat_completion_request_tool_choice.rb +13 -0
- data/lib/Apologist/types/chat_completion_request_tool_choice_zero.rb +13 -0
- data/lib/Apologist/types/chat_completion_request_verbosity.rb +14 -0
- data/lib/Apologist/types/chat_completion_response.rb +21 -0
- data/lib/Apologist/types/chat_completion_response_choices_item.rb +15 -0
- data/lib/Apologist/types/chat_completion_response_usage.rb +13 -0
- data/lib/Apologist/types/chat_message.rb +11 -0
- data/lib/Apologist/types/chat_message_role.rb +13 -0
- data/lib/Apologist/types/cta_match_request.rb +11 -0
- data/lib/Apologist/types/error.rb +11 -0
- data/lib/Apologist/types/success_response.rb +11 -0
- data/lib/Apologist/types/tag_ref.rb +11 -0
- data/lib/Apologist/types/user.rb +23 -0
- data/lib/Apologist/types/user_flag.rb +18 -0
- data/lib/Apologist/types/webhook_agent_ref.rb +11 -0
- data/lib/Apologist/types/webhook_cta.rb +13 -0
- data/lib/Apologist/types/webhook_evaluation.rb +14 -0
- data/lib/Apologist/types/webhook_event_info.rb +13 -0
- data/lib/Apologist/types/webhook_event_info_key.rb +28 -0
- data/lib/Apologist/types/webhook_named_ref.rb +11 -0
- data/lib/Apologist/types/webhook_notification_ref.rb +12 -0
- data/lib/Apologist/types/webhook_payload.rb +30 -0
- data/lib/Apologist/users/client.rb +193 -0
- data/lib/Apologist/users/types/get_user_request.rb +11 -0
- data/lib/Apologist/users/types/get_user_response.rb +11 -0
- data/lib/Apologist/users/types/list_user_flags_request.rb +13 -0
- data/lib/Apologist/users/types/list_user_flags_response.rb +17 -0
- data/lib/Apologist/users/types/list_users_request.rb +23 -0
- data/lib/Apologist/users/types/list_users_response.rb +17 -0
- data/lib/Apologist/users/types/update_user_response.rb +11 -0
- data/lib/Apologist/users/types/user_update_request.rb +17 -0
- data/lib/Apologist/users/types/user_update_request_tags_item.rb +15 -0
- data/lib/Apologist/version.rb +5 -0
- data/lib/Apologist.rb +131 -0
- data/reference.md +2927 -0
- metadata +183 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Internal
|
|
5
|
+
module Types
|
|
6
|
+
# Utilities for dealing with and checking types
|
|
7
|
+
module Utils
|
|
8
|
+
# Wraps a type into a type function
|
|
9
|
+
#
|
|
10
|
+
# @param type [Proc, Object]
|
|
11
|
+
# @return [Proc]
|
|
12
|
+
def self.wrap_type(type)
|
|
13
|
+
case type
|
|
14
|
+
when Proc
|
|
15
|
+
type
|
|
16
|
+
else
|
|
17
|
+
-> { type }
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Resolves a type or type function into a type
|
|
22
|
+
#
|
|
23
|
+
# @param type [Proc, Object]
|
|
24
|
+
# @return [Object]
|
|
25
|
+
def self.unwrap_type(type)
|
|
26
|
+
type.is_a?(Proc) ? type.call : type
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.coerce(target, value, strict: false)
|
|
30
|
+
type = unwrap_type(target)
|
|
31
|
+
|
|
32
|
+
case type
|
|
33
|
+
in Array
|
|
34
|
+
case value
|
|
35
|
+
when ::Array
|
|
36
|
+
return type.coerce(value, strict: strict)
|
|
37
|
+
when Set, ::Hash
|
|
38
|
+
return coerce(type, value.to_a)
|
|
39
|
+
end
|
|
40
|
+
in Hash
|
|
41
|
+
case value
|
|
42
|
+
when ::Hash
|
|
43
|
+
return type.coerce(value, strict: strict)
|
|
44
|
+
when ::Array
|
|
45
|
+
return coerce(type, value.to_h)
|
|
46
|
+
end
|
|
47
|
+
in ->(t) { t <= NilClass }
|
|
48
|
+
return nil
|
|
49
|
+
in ->(t) { t <= String }
|
|
50
|
+
case value
|
|
51
|
+
when String, Symbol, Numeric, TrueClass, FalseClass
|
|
52
|
+
return value.to_s
|
|
53
|
+
end
|
|
54
|
+
in ->(t) { t <= Symbol }
|
|
55
|
+
case value
|
|
56
|
+
when Symbol, String
|
|
57
|
+
return value.to_sym
|
|
58
|
+
end
|
|
59
|
+
in ->(t) { t <= Integer }
|
|
60
|
+
case value
|
|
61
|
+
when Numeric, String, Time
|
|
62
|
+
return value.to_i
|
|
63
|
+
end
|
|
64
|
+
in ->(t) { t <= Float }
|
|
65
|
+
case value
|
|
66
|
+
when Numeric, Time, String
|
|
67
|
+
return value.to_f
|
|
68
|
+
end
|
|
69
|
+
in ->(t) { t <= Model }
|
|
70
|
+
case value
|
|
71
|
+
when type
|
|
72
|
+
return value
|
|
73
|
+
when ::Hash
|
|
74
|
+
return type.coerce(value, strict: strict)
|
|
75
|
+
end
|
|
76
|
+
in Module
|
|
77
|
+
case type
|
|
78
|
+
in ->(t) {
|
|
79
|
+
t.singleton_class.included_modules.include?(Enum) ||
|
|
80
|
+
t.singleton_class.included_modules.include?(Union)
|
|
81
|
+
}
|
|
82
|
+
return type.coerce(value, strict: strict)
|
|
83
|
+
else
|
|
84
|
+
value # rubocop:disable Lint/Void
|
|
85
|
+
end
|
|
86
|
+
else
|
|
87
|
+
value # rubocop:disable Lint/Void
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
raise Errors::TypeError, "cannot coerce value of type `#{value.class}` to `#{target}`" if strict
|
|
91
|
+
|
|
92
|
+
value
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def self.symbolize_keys(hash)
|
|
96
|
+
hash.transform_keys(&:to_sym)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Converts camelCase keys to snake_case symbols
|
|
100
|
+
# This allows SDK methods to accept both snake_case and camelCase keys
|
|
101
|
+
# e.g., { refundMethod: ... } becomes { refund_method: ... }
|
|
102
|
+
#
|
|
103
|
+
# @param hash [Hash]
|
|
104
|
+
# @return [Hash]
|
|
105
|
+
def self.normalize_keys(hash)
|
|
106
|
+
hash.transform_keys do |key|
|
|
107
|
+
key_str = key.to_s
|
|
108
|
+
# Convert camelCase to snake_case
|
|
109
|
+
snake_case = key_str.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase
|
|
110
|
+
snake_case.to_sym
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Internal
|
|
5
|
+
module UrlEncoded
|
|
6
|
+
# @api private
|
|
7
|
+
class Request < Apologist::Internal::Http::BaseRequest
|
|
8
|
+
attr_reader :body
|
|
9
|
+
|
|
10
|
+
# @param base_url [String] The base URL for the request
|
|
11
|
+
# @param path [String] The path for the request
|
|
12
|
+
# @param method [Symbol] The HTTP method for the request (:get, :post, etc.)
|
|
13
|
+
# @param headers [Hash] Additional headers for the request (optional)
|
|
14
|
+
# @param query [Hash] Query parameters for the request (optional)
|
|
15
|
+
# @param body [Object, nil] The form-urlencoded request body (optional)
|
|
16
|
+
# @param request_options [Apologist::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
17
|
+
def initialize(base_url:, path:, method:, headers: {}, query: {}, body: nil, request_options: {})
|
|
18
|
+
super(base_url:, path:, method:, headers:, query:, request_options:)
|
|
19
|
+
|
|
20
|
+
@body = body
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# @return [Hash] The encoded HTTP request headers.
|
|
24
|
+
# @param protected_keys [Array<String>] Header keys set by the SDK client (e.g. auth, metadata)
|
|
25
|
+
# that must not be overridden by additional_headers from request_options.
|
|
26
|
+
def encode_headers(protected_keys: [])
|
|
27
|
+
sdk_headers = {
|
|
28
|
+
"Content-Type" => "application/x-www-form-urlencoded",
|
|
29
|
+
"Accept" => "application/json"
|
|
30
|
+
}.merge(@headers)
|
|
31
|
+
merge_additional_headers(sdk_headers, protected_keys:)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# @return [String, nil] The encoded HTTP request body.
|
|
35
|
+
def encode_body
|
|
36
|
+
@body.nil? ? nil : URI.encode_www_form(@body.to_h.compact)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Shares
|
|
5
|
+
class Client
|
|
6
|
+
# @param client [Apologist::Internal::Http::RawClient]
|
|
7
|
+
#
|
|
8
|
+
# @return [void]
|
|
9
|
+
def initialize(client:)
|
|
10
|
+
@client = client
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Public, unauthenticated read of the messages behind a share token. The token is the bearer capability and
|
|
14
|
+
# enforces tenant isolation against the host agent. An empty or invalid token yields an empty messages array.
|
|
15
|
+
#
|
|
16
|
+
# @param request_options [Hash]
|
|
17
|
+
# @param params [Hash]
|
|
18
|
+
# @option request_options [String] :base_url
|
|
19
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
20
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
21
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
22
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
23
|
+
# @option params [String] :token
|
|
24
|
+
#
|
|
25
|
+
# @example
|
|
26
|
+
# client.shares.get_shared_messages(token: "token")
|
|
27
|
+
#
|
|
28
|
+
# @return [Apologist::Shares::Types::GetSharedMessagesResponse]
|
|
29
|
+
def get_shared_messages(request_options: {}, **params)
|
|
30
|
+
params = Apologist::Internal::Types::Utils.normalize_keys(params)
|
|
31
|
+
request = Apologist::Internal::JSON::Request.new(
|
|
32
|
+
base_url: request_options[:base_url],
|
|
33
|
+
method: "GET",
|
|
34
|
+
path: "shares/#{URI.encode_uri_component(params[:token].to_s)}",
|
|
35
|
+
request_options: request_options
|
|
36
|
+
)
|
|
37
|
+
begin
|
|
38
|
+
response = @client.send(request)
|
|
39
|
+
rescue Net::HTTPRequestTimeout
|
|
40
|
+
raise Apologist::Errors::TimeoutError
|
|
41
|
+
end
|
|
42
|
+
code = response.code.to_i
|
|
43
|
+
if code.between?(200, 299)
|
|
44
|
+
Apologist::Shares::Types::GetSharedMessagesResponse.load(response.body)
|
|
45
|
+
else
|
|
46
|
+
error_class = Apologist::Errors::ResponseError.subclass_for_code(code)
|
|
47
|
+
raise error_class.new(response.body, code: code)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Shares
|
|
5
|
+
module Types
|
|
6
|
+
class GetSharedMessagesResponse < Internal::Types::Model
|
|
7
|
+
field :messages, -> { Internal::Types::Array[Internal::Types::Hash[String, Object]] }, optional: true, nullable: false
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
class ChatCompletionRequestLogprobs < Internal::Types::Model
|
|
6
|
+
extend Apologist::Internal::Types::Union
|
|
7
|
+
|
|
8
|
+
member -> { Internal::Types::Boolean }
|
|
9
|
+
|
|
10
|
+
member -> { Integer }
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
class ChatCompletionRequestMetadata < Internal::Types::Model
|
|
6
|
+
field :anonymous, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
7
|
+
|
|
8
|
+
field :conversation, -> { String }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :language, -> { String }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :max_memories, -> { Integer }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :parent_url, -> { String }, optional: true, nullable: false
|
|
15
|
+
|
|
16
|
+
field :parent_host, -> { String }, optional: true, nullable: false
|
|
17
|
+
|
|
18
|
+
field :session, -> { String }, optional: true, nullable: false
|
|
19
|
+
|
|
20
|
+
field :device, -> { String }, optional: true, nullable: false
|
|
21
|
+
|
|
22
|
+
field :shared_prompt, -> { Integer }, optional: true, nullable: false
|
|
23
|
+
|
|
24
|
+
field :translation, -> { String }, optional: true, nullable: false
|
|
25
|
+
|
|
26
|
+
field :variables, -> { Internal::Types::Hash[String, String] }, optional: true, nullable: false
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
class ChatCompletionRequestResponseFormat < Internal::Types::Model
|
|
6
|
+
field :type, -> { Apologist::Types::ChatCompletionRequestResponseFormatType }, optional: true, nullable: false
|
|
7
|
+
|
|
8
|
+
field :json_schema, -> { Apologist::Types::ChatCompletionRequestResponseFormatJSONSchema }, optional: true, nullable: false
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
# Required when type is json_schema. Supplies the JSON Schema the structured output must conform to. Structured
|
|
6
|
+
# outputs are non-streaming.
|
|
7
|
+
class ChatCompletionRequestResponseFormatJSONSchema < Internal::Types::Model
|
|
8
|
+
field :name, -> { String }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :description, -> { String }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :schema, -> { Internal::Types::Hash[String, Object] }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :strict, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
module ChatCompletionRequestResponseFormatType
|
|
6
|
+
extend Apologist::Internal::Types::Enum
|
|
7
|
+
|
|
8
|
+
TEXT = "text"
|
|
9
|
+
HTML = "html"
|
|
10
|
+
JSON_ = "json"
|
|
11
|
+
RAW = "raw"
|
|
12
|
+
JSON_SCHEMA = "json_schema"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
class ChatCompletionRequestToolChoice < Internal::Types::Model
|
|
6
|
+
extend Apologist::Internal::Types::Union
|
|
7
|
+
|
|
8
|
+
member -> { Apologist::Types::ChatCompletionRequestToolChoiceZero }
|
|
9
|
+
|
|
10
|
+
member -> { Internal::Types::Hash[String, Object] }
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
class ChatCompletionResponse < Internal::Types::Model
|
|
6
|
+
field :id, -> { String }, optional: true, nullable: false
|
|
7
|
+
|
|
8
|
+
field :object, -> { String }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :created, -> { Integer }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :model, -> { String }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :choices, -> { Internal::Types::Array[Apologist::Types::ChatCompletionResponseChoicesItem] }, optional: true, nullable: false
|
|
15
|
+
|
|
16
|
+
field :usage, -> { Apologist::Types::ChatCompletionResponseUsage }, optional: true, nullable: false
|
|
17
|
+
|
|
18
|
+
field :cached, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
class ChatCompletionResponseChoicesItem < Internal::Types::Model
|
|
6
|
+
field :index, -> { Integer }, optional: true, nullable: false
|
|
7
|
+
|
|
8
|
+
field :message, -> { Apologist::Types::ChatMessage }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :logprobs, -> { Internal::Types::Hash[String, Object] }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :finish_reason, -> { String }, optional: true, nullable: false
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
class ChatCompletionResponseUsage < Internal::Types::Model
|
|
6
|
+
field :prompt_tokens, -> { Integer }, optional: true, nullable: false
|
|
7
|
+
|
|
8
|
+
field :completion_tokens, -> { Integer }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :total_tokens, -> { Integer }, optional: true, nullable: false
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
class ChatMessage < Internal::Types::Model
|
|
6
|
+
field :role, -> { Apologist::Types::ChatMessageRole }, optional: true, nullable: false
|
|
7
|
+
|
|
8
|
+
field :content, -> { String }, optional: true, nullable: false
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
class Error < Internal::Types::Model
|
|
6
|
+
field :success, -> { Internal::Types::Boolean }, optional: false, nullable: false
|
|
7
|
+
|
|
8
|
+
field :errors, -> { Internal::Types::Array[String] }, optional: false, nullable: false
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
class SuccessResponse < Internal::Types::Model
|
|
6
|
+
field :success, -> { Internal::Types::Boolean }, optional: false, nullable: false
|
|
7
|
+
|
|
8
|
+
field :message, -> { String }, optional: false, nullable: false
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
class User < Internal::Types::Model
|
|
6
|
+
field :id, -> { String }, optional: true, nullable: false
|
|
7
|
+
|
|
8
|
+
field :external_id, -> { String }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :team_id, -> { Integer }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :created_at, -> { String }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :migrated_at, -> { String }, optional: true, nullable: false
|
|
15
|
+
|
|
16
|
+
field :migrated_to_user_id, -> { String }, optional: true, nullable: false
|
|
17
|
+
|
|
18
|
+
field :tags, -> { Internal::Types::Array[Apologist::Types::TagRef] }, optional: true, nullable: false
|
|
19
|
+
|
|
20
|
+
field :responder_id, -> { Integer }, optional: true, nullable: false
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
# A team-level user flag definition from the user_flags table.
|
|
6
|
+
class UserFlag < Internal::Types::Model
|
|
7
|
+
field :id, -> { Integer }, optional: true, nullable: false
|
|
8
|
+
|
|
9
|
+
field :name, -> { String }, optional: true, nullable: false
|
|
10
|
+
|
|
11
|
+
field :user_id, -> { Integer }, optional: true, nullable: false
|
|
12
|
+
|
|
13
|
+
field :team_id, -> { Integer }, optional: true, nullable: false
|
|
14
|
+
|
|
15
|
+
field :synced_at, -> { String }, optional: true, nullable: false
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
class WebhookAgentRef < Internal::Types::Model
|
|
6
|
+
field :id, -> { Integer }, optional: false, nullable: false
|
|
7
|
+
|
|
8
|
+
field :name, -> { String }, optional: true, nullable: false
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
class WebhookCta < Internal::Types::Model
|
|
6
|
+
field :id, -> { Integer }, optional: false, nullable: false
|
|
7
|
+
|
|
8
|
+
field :name, -> { String }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :content, -> { String }, optional: true, nullable: false
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
# Result of an evaluation run for CTA/guardrail events.
|
|
6
|
+
class WebhookEvaluation < Internal::Types::Model
|
|
7
|
+
field :score, -> { Integer }, optional: true, nullable: false
|
|
8
|
+
|
|
9
|
+
field :passed, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
10
|
+
|
|
11
|
+
field :content, -> { String }, optional: true, nullable: false
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
class WebhookEventInfo < Internal::Types::Model
|
|
6
|
+
field :key, -> { Apologist::Types::WebhookEventInfoKey }, optional: false, nullable: false
|
|
7
|
+
|
|
8
|
+
field :label, -> { String }, optional: false, nullable: false
|
|
9
|
+
|
|
10
|
+
field :occurred_at, -> { String }, optional: false, nullable: false
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
module WebhookEventInfoKey
|
|
6
|
+
extend Apologist::Internal::Types::Enum
|
|
7
|
+
|
|
8
|
+
PROMPT_SUBMIT = "prompt_submit"
|
|
9
|
+
RESPONSE_START = "response_start"
|
|
10
|
+
RESPONSE_END = "response_end"
|
|
11
|
+
AUTOMATIONS_END = "automations_end"
|
|
12
|
+
RESPONSE_LIKE = "response_like"
|
|
13
|
+
RESPONSE_FLAG = "response_flag"
|
|
14
|
+
RESPONSE_FEEDBACK = "response_feedback"
|
|
15
|
+
REFERRAL_CLICK = "referral_click"
|
|
16
|
+
CTA_TRIGGER = "cta_trigger"
|
|
17
|
+
CTA_CLICK = "cta_click"
|
|
18
|
+
GUARDRAIL_TRIGGER = "guardrail_trigger"
|
|
19
|
+
ATTRIBUTION_CLICK = "attribution_click"
|
|
20
|
+
FOOTER_CLICK = "footer_click"
|
|
21
|
+
NEW_USER = "new_user"
|
|
22
|
+
NEW_DEVICE = "new_device"
|
|
23
|
+
NEW_SESSION = "new_session"
|
|
24
|
+
NEW_CONVERSATION = "new_conversation"
|
|
25
|
+
ERROR = "error"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
class WebhookNamedRef < Internal::Types::Model
|
|
6
|
+
field :id, -> { Integer }, optional: false, nullable: false
|
|
7
|
+
|
|
8
|
+
field :name, -> { String }, optional: true, nullable: false
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|