exa-ai 0.12.2 → 0.14.0
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 +4 -4
- data/README.md +120 -83
- data/exe/exa-ai +45 -152
- data/exe/exa-ai-agent-run-create +55 -20
- data/exe/exa-ai-agent-run-delete +1 -8
- data/exe/exa-ai-agent-run-events +21 -1
- data/exe/exa-ai-agent-run-list +1 -1
- data/exe/{exa-ai-research-list → exa-ai-agent-run-stop} +31 -32
- data/exe/exa-ai-answer +25 -0
- data/exe/exa-ai-context +6 -2
- data/exe/exa-ai-find-similar +26 -68
- data/exe/exa-ai-get-contents +138 -42
- data/exe/exa-ai-search +27 -104
- data/exe/exa-ai-search-monitor-batch +93 -0
- data/exe/exa-ai-search-monitor-create +104 -0
- data/exe/exa-ai-search-monitor-delete +69 -0
- data/exe/exa-ai-search-monitor-get +69 -0
- data/exe/exa-ai-search-monitor-list +73 -0
- data/exe/exa-ai-search-monitor-runs-get +68 -0
- data/exe/exa-ai-search-monitor-runs-list +75 -0
- data/exe/exa-ai-search-monitor-trigger +69 -0
- data/exe/exa-ai-search-monitor-update +102 -0
- data/lib/exa/cli/base.rb +57 -0
- data/lib/exa/cli/contents_flags.rb +199 -0
- data/lib/exa/cli/formatters/agent_run_formatter.rb +79 -3
- data/lib/exa/cli/formatters/search_formatter.rb +18 -2
- data/lib/exa/cli/formatters/search_monitor_formatter.rb +98 -0
- data/lib/exa/cli/search_parser.rb +46 -87
- data/lib/exa/client.rb +183 -333
- data/lib/exa/middleware/raise_error.rb +14 -0
- data/lib/exa/resources/agent_run.rb +5 -3
- data/lib/exa/resources/agent_run_deletion.rb +17 -0
- data/lib/exa/resources/answer.rb +3 -3
- data/lib/exa/resources/contents_result.rb +5 -1
- data/lib/exa/resources/find_similar_result.rb +5 -1
- data/lib/exa/resources/search_monitor.rb +42 -0
- data/lib/exa/resources/search_monitor_batch_result.rb +11 -0
- data/lib/exa/resources/{research_list.rb → search_monitor_list.rb} +3 -2
- data/lib/exa/resources/search_monitor_run.rb +46 -0
- data/lib/exa/resources/search_monitor_trigger_result.rb +11 -0
- data/lib/exa/resources/search_result.rb +11 -1
- data/lib/exa/services/agent_run_cancel.rb +1 -12
- data/lib/exa/services/agent_run_create.rb +1 -12
- data/lib/exa/services/agent_run_delete.rb +6 -14
- data/lib/exa/services/agent_run_events.rb +33 -4
- data/lib/exa/services/agent_run_get.rb +1 -12
- data/lib/exa/services/agent_run_list.rb +1 -12
- data/lib/exa/services/agent_run_stop.rb +21 -0
- data/lib/exa/services/agent_run_stream.rb +56 -52
- data/lib/exa/services/answer.rb +5 -2
- data/lib/exa/services/answer_stream.rb +57 -46
- data/lib/exa/services/context.rb +3 -1
- data/lib/exa/services/find_similar.rb +9 -2
- data/lib/exa/services/get_contents.rb +14 -15
- data/lib/exa/services/parameter_converter.rb +128 -111
- data/lib/exa/services/search.rb +58 -19
- data/lib/exa/services/search_monitors/batch.rb +36 -0
- data/lib/exa/services/search_monitors/create.rb +37 -0
- data/lib/exa/services/search_monitors/delete.rb +22 -0
- data/lib/exa/services/search_monitors/get.rb +22 -0
- data/lib/exa/services/search_monitors/list.rb +29 -0
- data/lib/exa/services/search_monitors/runs_get.rb +23 -0
- data/lib/exa/services/search_monitors/runs_list.rb +29 -0
- data/lib/exa/services/search_monitors/trigger.rb +22 -0
- data/lib/exa/services/search_monitors/update.rb +42 -0
- data/lib/exa/services/search_stream.rb +38 -0
- data/lib/exa/version.rb +1 -1
- data/lib/exa.rb +18 -56
- metadata +31 -94
- data/exe/exa-ai-enrichment-cancel +0 -108
- data/exe/exa-ai-enrichment-create +0 -226
- data/exe/exa-ai-enrichment-delete +0 -122
- data/exe/exa-ai-enrichment-get +0 -104
- data/exe/exa-ai-enrichment-list +0 -99
- data/exe/exa-ai-enrichment-update +0 -171
- data/exe/exa-ai-import-create +0 -253
- data/exe/exa-ai-import-delete +0 -92
- data/exe/exa-ai-import-get +0 -92
- data/exe/exa-ai-import-list +0 -72
- data/exe/exa-ai-import-update +0 -164
- data/exe/exa-ai-monitor-create +0 -223
- data/exe/exa-ai-monitor-delete +0 -101
- data/exe/exa-ai-monitor-get +0 -92
- data/exe/exa-ai-monitor-list +0 -90
- data/exe/exa-ai-monitor-runs-get +0 -103
- data/exe/exa-ai-monitor-runs-list +0 -110
- data/exe/exa-ai-monitor-update +0 -207
- data/exe/exa-ai-research-get +0 -109
- data/exe/exa-ai-research-start +0 -174
- data/exe/exa-ai-webset-cancel +0 -97
- data/exe/exa-ai-webset-create +0 -254
- data/exe/exa-ai-webset-delete +0 -111
- data/exe/exa-ai-webset-get +0 -93
- data/exe/exa-ai-webset-item-delete +0 -111
- data/exe/exa-ai-webset-item-get +0 -105
- data/exe/exa-ai-webset-item-list +0 -108
- data/exe/exa-ai-webset-list +0 -91
- data/exe/exa-ai-webset-search-cancel +0 -104
- data/exe/exa-ai-webset-search-create +0 -247
- data/exe/exa-ai-webset-search-get +0 -105
- data/exe/exa-ai-webset-update +0 -143
- data/lib/exa/cli/formatters/enrichment_formatter.rb +0 -125
- data/lib/exa/cli/formatters/import_formatter.rb +0 -153
- data/lib/exa/cli/formatters/monitor_formatter.rb +0 -144
- data/lib/exa/cli/formatters/monitor_run_formatter.rb +0 -126
- data/lib/exa/cli/formatters/research_formatter.rb +0 -124
- data/lib/exa/cli/formatters/webset_formatter.rb +0 -134
- data/lib/exa/cli/formatters/webset_item_formatter.rb +0 -131
- data/lib/exa/cli/formatters/webset_search_formatter.rb +0 -57
- data/lib/exa/constants/websets.rb +0 -19
- data/lib/exa/resources/import.rb +0 -86
- data/lib/exa/resources/import_collection.rb +0 -33
- data/lib/exa/resources/monitor.rb +0 -48
- data/lib/exa/resources/monitor_collection.rb +0 -30
- data/lib/exa/resources/monitor_run.rb +0 -52
- data/lib/exa/resources/monitor_run_collection.rb +0 -30
- data/lib/exa/resources/research_task.rb +0 -39
- data/lib/exa/resources/webset.rb +0 -74
- data/lib/exa/resources/webset_collection.rb +0 -33
- data/lib/exa/resources/webset_enrichment.rb +0 -71
- data/lib/exa/resources/webset_enrichment_collection.rb +0 -28
- data/lib/exa/resources/webset_item_collection.rb +0 -33
- data/lib/exa/resources/webset_search.rb +0 -112
- data/lib/exa/services/research_get.rb +0 -30
- data/lib/exa/services/research_list.rb +0 -37
- data/lib/exa/services/research_start.rb +0 -26
- data/lib/exa/services/websets/cancel.rb +0 -36
- data/lib/exa/services/websets/cancel_enrichment.rb +0 -35
- data/lib/exa/services/websets/cancel_search.rb +0 -44
- data/lib/exa/services/websets/create.rb +0 -45
- data/lib/exa/services/websets/create_enrichment.rb +0 -35
- data/lib/exa/services/websets/create_search.rb +0 -48
- data/lib/exa/services/websets/create_search_validator.rb +0 -128
- data/lib/exa/services/websets/create_validator.rb +0 -213
- data/lib/exa/services/websets/delete.rb +0 -36
- data/lib/exa/services/websets/delete_enrichment.rb +0 -35
- data/lib/exa/services/websets/delete_item.rb +0 -20
- data/lib/exa/services/websets/get_item.rb +0 -20
- data/lib/exa/services/websets/get_search.rb +0 -43
- data/lib/exa/services/websets/import_create.rb +0 -40
- data/lib/exa/services/websets/import_delete.rb +0 -37
- data/lib/exa/services/websets/import_get.rb +0 -37
- data/lib/exa/services/websets/import_list.rb +0 -25
- data/lib/exa/services/websets/import_update.rb +0 -38
- data/lib/exa/services/websets/import_upload.rb +0 -58
- data/lib/exa/services/websets/list.rb +0 -25
- data/lib/exa/services/websets/list_items.rb +0 -26
- data/lib/exa/services/websets/monitors/create.rb +0 -42
- data/lib/exa/services/websets/monitors/delete.rb +0 -32
- data/lib/exa/services/websets/monitors/get.rb +0 -33
- data/lib/exa/services/websets/monitors/list.rb +0 -27
- data/lib/exa/services/websets/monitors/runs/get.rb +0 -37
- data/lib/exa/services/websets/monitors/runs/list.rb +0 -30
- data/lib/exa/services/websets/monitors/update.rb +0 -33
- data/lib/exa/services/websets/retrieve.rb +0 -47
- data/lib/exa/services/websets/retrieve_enrichment.rb +0 -35
- data/lib/exa/services/websets/update.rb +0 -37
- data/lib/exa/services/websets/update_enrichment.rb +0 -36
- data/lib/exa/services/websets_parameter_converter.rb +0 -45
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Exa
|
|
4
|
-
module CLI
|
|
5
|
-
module Formatters
|
|
6
|
-
class WebsetFormatter
|
|
7
|
-
def self.format(webset, output_format)
|
|
8
|
-
case output_format
|
|
9
|
-
when "json"
|
|
10
|
-
JSON.generate(webset.to_h)
|
|
11
|
-
when "pretty"
|
|
12
|
-
JSON.pretty_generate(webset.to_h)
|
|
13
|
-
when "text"
|
|
14
|
-
format_as_text(webset)
|
|
15
|
-
when "toon"
|
|
16
|
-
Exa::CLI::Base.encode_as_toon(webset.to_h)
|
|
17
|
-
else
|
|
18
|
-
raise ArgumentError, "Unknown output format: #{output_format}"
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def self.format_collection(collection, output_format)
|
|
23
|
-
case output_format
|
|
24
|
-
when "json"
|
|
25
|
-
JSON.generate(collection.to_h)
|
|
26
|
-
when "pretty"
|
|
27
|
-
format_collection_as_pretty(collection)
|
|
28
|
-
when "text"
|
|
29
|
-
format_collection_as_text(collection)
|
|
30
|
-
when "toon"
|
|
31
|
-
Exa::CLI::Base.encode_as_toon(collection.to_h)
|
|
32
|
-
else
|
|
33
|
-
raise ArgumentError, "Unknown output format: #{output_format}"
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def self.format_as_text(webset)
|
|
38
|
-
lines = []
|
|
39
|
-
lines << "Webset: #{webset.id}"
|
|
40
|
-
lines << "Status: #{webset.status}"
|
|
41
|
-
lines << "Title: #{webset.title}" if webset.title
|
|
42
|
-
lines << "Created: #{webset.created_at}" if webset.created_at
|
|
43
|
-
lines << "Updated: #{webset.updated_at}" if webset.updated_at
|
|
44
|
-
|
|
45
|
-
if webset.searches && !webset.searches.empty?
|
|
46
|
-
lines << "\nSearches:"
|
|
47
|
-
webset.searches.each do |search|
|
|
48
|
-
lines << " - #{search['query']}" if search['query']
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
if webset.enrichments && !webset.enrichments.empty?
|
|
53
|
-
lines << "\nEnrichments: #{webset.enrichments.length}"
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
lines.join("\n")
|
|
57
|
-
end
|
|
58
|
-
private_class_method :format_as_text
|
|
59
|
-
|
|
60
|
-
def self.format_collection_as_text(collection)
|
|
61
|
-
lines = ["Websets (#{collection.data.length} items):"]
|
|
62
|
-
collection.data.each do |ws|
|
|
63
|
-
lines << "\n #{ws['id']}"
|
|
64
|
-
lines << " Status: #{ws['status']}"
|
|
65
|
-
lines << " Title: #{ws['title']}" if ws['title']
|
|
66
|
-
lines << " Created: #{ws['createdAt']}" if ws['createdAt']
|
|
67
|
-
end
|
|
68
|
-
lines.join("\n")
|
|
69
|
-
end
|
|
70
|
-
private_class_method :format_collection_as_text
|
|
71
|
-
|
|
72
|
-
def self.format_collection_as_pretty(collection)
|
|
73
|
-
lines = []
|
|
74
|
-
|
|
75
|
-
# Header with count and pagination info
|
|
76
|
-
header = "Websets (#{collection.data.length} items)"
|
|
77
|
-
header += " - Page #{collection.has_more ? '1 of many' : '1 of 1'}" if collection.data.any?
|
|
78
|
-
lines << header
|
|
79
|
-
|
|
80
|
-
if collection.has_more
|
|
81
|
-
lines << "Next Cursor: #{collection.next_cursor}"
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
lines << ""
|
|
85
|
-
|
|
86
|
-
# Format each webset
|
|
87
|
-
collection.data.each_with_index do |ws, idx|
|
|
88
|
-
lines << "" if idx > 0 # Blank line between websets
|
|
89
|
-
|
|
90
|
-
lines << "Webset ID: #{ws['id']}"
|
|
91
|
-
lines << "Status: #{ws['status']}"
|
|
92
|
-
lines << "Title: #{ws['title']}" if ws['title']
|
|
93
|
-
lines << "External ID: #{ws['externalId']}" if ws['externalId']
|
|
94
|
-
lines << "Created: #{ws['createdAt']}" if ws['createdAt']
|
|
95
|
-
lines << "Updated: #{ws['updatedAt']}" if ws['updatedAt']
|
|
96
|
-
|
|
97
|
-
# Searches
|
|
98
|
-
if ws['searches'] && !ws['searches'].empty?
|
|
99
|
-
lines << ""
|
|
100
|
-
lines << "Searches (#{ws['searches'].length}):"
|
|
101
|
-
ws['searches'].each do |search|
|
|
102
|
-
status_indicator = case search['status']
|
|
103
|
-
when 'completed' then '✓'
|
|
104
|
-
when 'running' then '→'
|
|
105
|
-
when 'failed' then '✗'
|
|
106
|
-
else '•'
|
|
107
|
-
end
|
|
108
|
-
lines << " #{status_indicator} #{search['query']} (#{search['status']})" if search['query']
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
# Enrichments
|
|
113
|
-
if ws['enrichments'] && !ws['enrichments'].empty?
|
|
114
|
-
lines << "Enrichments: #{ws['enrichments'].length}"
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
# Monitors
|
|
118
|
-
if ws['monitors'] && !ws['monitors'].empty?
|
|
119
|
-
lines << "Monitors: #{ws['monitors'].length}"
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
# Imports
|
|
123
|
-
if ws['imports'] && !ws['imports'].empty?
|
|
124
|
-
lines << "Imports: #{ws['imports'].length}"
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
lines.join("\n")
|
|
129
|
-
end
|
|
130
|
-
private_class_method :format_collection_as_pretty
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
end
|
|
134
|
-
end
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Exa
|
|
4
|
-
module CLI
|
|
5
|
-
module Formatters
|
|
6
|
-
class WebsetItemFormatter
|
|
7
|
-
def self.format(item, output_format)
|
|
8
|
-
case output_format
|
|
9
|
-
when "json"
|
|
10
|
-
JSON.generate(item)
|
|
11
|
-
when "pretty"
|
|
12
|
-
format_as_pretty(item)
|
|
13
|
-
when "text"
|
|
14
|
-
format_as_text(item)
|
|
15
|
-
when "toon"
|
|
16
|
-
Exa::CLI::Base.encode_as_toon(item)
|
|
17
|
-
else
|
|
18
|
-
raise ArgumentError, "Unknown output format: #{output_format}"
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def self.format_collection(collection, output_format)
|
|
23
|
-
case output_format
|
|
24
|
-
when "json"
|
|
25
|
-
JSON.generate(collection.to_h)
|
|
26
|
-
when "pretty"
|
|
27
|
-
format_collection_as_pretty(collection)
|
|
28
|
-
when "text"
|
|
29
|
-
format_collection_as_text(collection)
|
|
30
|
-
when "toon"
|
|
31
|
-
Exa::CLI::Base.encode_as_toon(collection.to_h)
|
|
32
|
-
else
|
|
33
|
-
raise ArgumentError, "Unknown output format: #{output_format}"
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def self.format_as_pretty(item)
|
|
38
|
-
lines = []
|
|
39
|
-
lines << "Item ID: #{item['id']}"
|
|
40
|
-
lines << "URL: #{item['url']}" if item['url']
|
|
41
|
-
lines << "Title: #{item['title']}" if item['title']
|
|
42
|
-
lines << "Status: #{item['status']}" if item['status']
|
|
43
|
-
lines << "Created: #{item['createdAt']}" if item['createdAt']
|
|
44
|
-
lines << "Updated: #{item['updatedAt']}" if item['updatedAt']
|
|
45
|
-
|
|
46
|
-
if item['entity']
|
|
47
|
-
lines << ""
|
|
48
|
-
lines << "Entity:"
|
|
49
|
-
lines << " Type: #{item['entity']['type']}" if item['entity']['type']
|
|
50
|
-
lines << " Name: #{item['entity']['name']}" if item['entity']['name']
|
|
51
|
-
lines << " Description: #{item['entity']['description']}" if item['entity']['description']
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
lines.join("\n")
|
|
55
|
-
end
|
|
56
|
-
private_class_method :format_as_pretty
|
|
57
|
-
|
|
58
|
-
def self.format_as_text(item)
|
|
59
|
-
lines = []
|
|
60
|
-
lines << "Item: #{item['id']}"
|
|
61
|
-
lines << "URL: #{item['url']}" if item['url']
|
|
62
|
-
lines << "Title: #{item['title']}" if item['title']
|
|
63
|
-
lines << "Status: #{item['status']}" if item['status']
|
|
64
|
-
lines << "Created: #{item['createdAt']}" if item['createdAt']
|
|
65
|
-
lines << "Updated: #{item['updatedAt']}" if item['updatedAt']
|
|
66
|
-
|
|
67
|
-
if item['entity']
|
|
68
|
-
lines << "\nEntity:"
|
|
69
|
-
lines << " Type: #{item['entity']['type']}" if item['entity']['type']
|
|
70
|
-
lines << " Name: #{item['entity']['name']}" if item['entity']['name']
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
lines.join("\n")
|
|
74
|
-
end
|
|
75
|
-
private_class_method :format_as_text
|
|
76
|
-
|
|
77
|
-
def self.format_collection_as_pretty(collection)
|
|
78
|
-
lines = []
|
|
79
|
-
lines << "Webset Items (#{collection.data.length} items)"
|
|
80
|
-
|
|
81
|
-
if collection.has_more
|
|
82
|
-
lines << "Next Cursor: #{collection.next_cursor}"
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
lines << ""
|
|
86
|
-
|
|
87
|
-
collection.data.each_with_index do |item, idx|
|
|
88
|
-
lines << "" if idx > 0 # Blank line between items
|
|
89
|
-
|
|
90
|
-
lines << "Item ID: #{item['id']}"
|
|
91
|
-
lines << "URL: #{item['url']}" if item['url']
|
|
92
|
-
lines << "Title: #{item['title']}" if item['title']
|
|
93
|
-
lines << "Status: #{item['status']}" if item['status']
|
|
94
|
-
lines << "Created: #{item['createdAt']}" if item['createdAt']
|
|
95
|
-
lines << "Updated: #{item['updatedAt']}" if item['updatedAt']
|
|
96
|
-
|
|
97
|
-
if item['entity']
|
|
98
|
-
entity_name = item['entity']['name']
|
|
99
|
-
entity_type = item['entity']['type']
|
|
100
|
-
lines << "Entity: #{entity_name}" if entity_name
|
|
101
|
-
lines << "Entity Type: #{entity_type}" if entity_type && !entity_name
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
lines.join("\n")
|
|
106
|
-
end
|
|
107
|
-
private_class_method :format_collection_as_pretty
|
|
108
|
-
|
|
109
|
-
def self.format_collection_as_text(collection)
|
|
110
|
-
lines = ["Webset Items (#{collection.data.length} items):"]
|
|
111
|
-
collection.data.each_with_index do |item, idx|
|
|
112
|
-
lines << "\n#{idx + 1}. #{item['id']}"
|
|
113
|
-
lines << " URL: #{item['url']}" if item['url']
|
|
114
|
-
lines << " Title: #{item['title']}" if item['title']
|
|
115
|
-
lines << " Status: #{item['status']}" if item['status']
|
|
116
|
-
if item['entity'] && item['entity']['name']
|
|
117
|
-
lines << " Entity: #{item['entity']['name']}"
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
if collection.has_more
|
|
122
|
-
lines << "\nMore available (cursor: #{collection.next_cursor})"
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
lines.join("\n")
|
|
126
|
-
end
|
|
127
|
-
private_class_method :format_collection_as_text
|
|
128
|
-
end
|
|
129
|
-
end
|
|
130
|
-
end
|
|
131
|
-
end
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Exa
|
|
4
|
-
module CLI
|
|
5
|
-
module Formatters
|
|
6
|
-
class WebsetSearchFormatter
|
|
7
|
-
def self.format(search, format)
|
|
8
|
-
case format
|
|
9
|
-
when "json"
|
|
10
|
-
JSON.pretty_generate(search.to_h)
|
|
11
|
-
when "pretty"
|
|
12
|
-
format_pretty(search)
|
|
13
|
-
when "text"
|
|
14
|
-
format_text(search)
|
|
15
|
-
when "toon"
|
|
16
|
-
Exa::CLI::Base.encode_as_toon(search.to_h)
|
|
17
|
-
else
|
|
18
|
-
JSON.pretty_generate(search.to_h)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
private
|
|
23
|
-
|
|
24
|
-
def self.format_pretty(search)
|
|
25
|
-
output = []
|
|
26
|
-
output << "Search ID: #{search.id}"
|
|
27
|
-
output << "Status: #{search.status}"
|
|
28
|
-
output << "Query: #{search.query}"
|
|
29
|
-
output << "Entity Type: #{search.entity&.[]('type') || 'N/A'}" if search.entity
|
|
30
|
-
output << "Count: #{search.count}" if search.count
|
|
31
|
-
output << "Behavior: #{search.behavior}"
|
|
32
|
-
output << "Recall: #{search.recall}" if search.recall
|
|
33
|
-
output << "Created: #{search.created_at}"
|
|
34
|
-
output << "Updated: #{search.updated_at}"
|
|
35
|
-
output << "Progress: #{search.progress}" if search.progress
|
|
36
|
-
output << ""
|
|
37
|
-
|
|
38
|
-
if search.canceled?
|
|
39
|
-
output << "Canceled: #{search.canceled_at}"
|
|
40
|
-
output << "Cancel Reason: #{search.canceled_reason}" if search.canceled_reason
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
output.join("\n")
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def self.format_text(search)
|
|
47
|
-
[
|
|
48
|
-
"ID: #{search.id}",
|
|
49
|
-
"Status: #{search.status}",
|
|
50
|
-
"Query: #{search.query}",
|
|
51
|
-
"Behavior: #{search.behavior}"
|
|
52
|
-
].join("\n")
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Exa
|
|
4
|
-
module Constants
|
|
5
|
-
module Websets
|
|
6
|
-
# Valid entity types for websets
|
|
7
|
-
ENTITY_TYPES = %w[company person article research_paper custom].freeze
|
|
8
|
-
|
|
9
|
-
# Valid enrichment formats
|
|
10
|
-
ENRICHMENT_FORMATS = %w[text date number options email phone url].freeze
|
|
11
|
-
|
|
12
|
-
# Valid source types for imports and exclusions
|
|
13
|
-
SOURCE_TYPES = %w[import webset].freeze
|
|
14
|
-
|
|
15
|
-
# Valid import formats
|
|
16
|
-
IMPORT_FORMATS = %w[csv].freeze
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
data/lib/exa/resources/import.rb
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Exa
|
|
4
|
-
module Resources
|
|
5
|
-
# Represents an import operation for bringing external data into Exa
|
|
6
|
-
#
|
|
7
|
-
# An import allows uploading CSV data containing entities (e.g., companies)
|
|
8
|
-
# to be processed and enriched within the Exa system.
|
|
9
|
-
class Import < Struct.new(
|
|
10
|
-
:id,
|
|
11
|
-
:object,
|
|
12
|
-
:status,
|
|
13
|
-
:format,
|
|
14
|
-
:entity,
|
|
15
|
-
:title,
|
|
16
|
-
:count,
|
|
17
|
-
:metadata,
|
|
18
|
-
:failed_reason,
|
|
19
|
-
:failed_at,
|
|
20
|
-
:failed_message,
|
|
21
|
-
:created_at,
|
|
22
|
-
:updated_at,
|
|
23
|
-
:upload_url,
|
|
24
|
-
:upload_valid_until,
|
|
25
|
-
keyword_init: true
|
|
26
|
-
)
|
|
27
|
-
def initialize(
|
|
28
|
-
id:,
|
|
29
|
-
object:,
|
|
30
|
-
status:,
|
|
31
|
-
format: nil,
|
|
32
|
-
entity: nil,
|
|
33
|
-
title: nil,
|
|
34
|
-
count: nil,
|
|
35
|
-
metadata: nil,
|
|
36
|
-
failed_reason: nil,
|
|
37
|
-
failed_at: nil,
|
|
38
|
-
failed_message: nil,
|
|
39
|
-
created_at: nil,
|
|
40
|
-
updated_at: nil,
|
|
41
|
-
upload_url: nil,
|
|
42
|
-
upload_valid_until: nil
|
|
43
|
-
)
|
|
44
|
-
super
|
|
45
|
-
freeze
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# Status helper methods
|
|
49
|
-
def pending?
|
|
50
|
-
status == "pending"
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def processing?
|
|
54
|
-
status == "processing"
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def completed?
|
|
58
|
-
status == "completed"
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def failed?
|
|
62
|
-
status == "failed"
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def to_h
|
|
66
|
-
{
|
|
67
|
-
id: id,
|
|
68
|
-
object: object,
|
|
69
|
-
status: status,
|
|
70
|
-
format: format,
|
|
71
|
-
entity: entity,
|
|
72
|
-
title: title,
|
|
73
|
-
count: count,
|
|
74
|
-
metadata: metadata,
|
|
75
|
-
failed_reason: failed_reason,
|
|
76
|
-
failed_at: failed_at,
|
|
77
|
-
failed_message: failed_message,
|
|
78
|
-
created_at: created_at,
|
|
79
|
-
updated_at: updated_at,
|
|
80
|
-
upload_url: upload_url,
|
|
81
|
-
upload_valid_until: upload_valid_until
|
|
82
|
-
}.compact
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Exa
|
|
4
|
-
module Resources
|
|
5
|
-
# Represents a paginated list of imports from the Exa API
|
|
6
|
-
#
|
|
7
|
-
# This class wraps the JSON response from the GET /websets/v0/imports endpoint
|
|
8
|
-
# and provides pagination support.
|
|
9
|
-
class ImportCollection < Struct.new(
|
|
10
|
-
:data,
|
|
11
|
-
:has_more,
|
|
12
|
-
:next_cursor,
|
|
13
|
-
keyword_init: true
|
|
14
|
-
)
|
|
15
|
-
def initialize(data:, has_more: false, next_cursor: nil)
|
|
16
|
-
super
|
|
17
|
-
freeze
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def empty?
|
|
21
|
-
data.empty?
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def to_h
|
|
25
|
-
{
|
|
26
|
-
data: data,
|
|
27
|
-
has_more: has_more,
|
|
28
|
-
next_cursor: next_cursor
|
|
29
|
-
}
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
module Exa
|
|
2
|
-
module Resources
|
|
3
|
-
# Represents a webset monitor that automates updates on a schedule
|
|
4
|
-
Monitor = Struct.new(
|
|
5
|
-
:id,
|
|
6
|
-
:object,
|
|
7
|
-
:status,
|
|
8
|
-
:webset_id,
|
|
9
|
-
:cadence,
|
|
10
|
-
:behavior,
|
|
11
|
-
:created_at,
|
|
12
|
-
:updated_at,
|
|
13
|
-
keyword_init: true
|
|
14
|
-
) do
|
|
15
|
-
def freeze
|
|
16
|
-
super
|
|
17
|
-
cadence.freeze if cadence
|
|
18
|
-
behavior.freeze if behavior
|
|
19
|
-
self
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def pending?
|
|
23
|
-
status == "pending"
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def active?
|
|
27
|
-
status == "active"
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def paused?
|
|
31
|
-
status == "paused"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def to_h
|
|
35
|
-
{
|
|
36
|
-
id: id,
|
|
37
|
-
object: object,
|
|
38
|
-
status: status,
|
|
39
|
-
webset_id: webset_id,
|
|
40
|
-
cadence: cadence,
|
|
41
|
-
behavior: behavior,
|
|
42
|
-
created_at: created_at,
|
|
43
|
-
updated_at: updated_at
|
|
44
|
-
}.compact
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Exa
|
|
4
|
-
module Resources
|
|
5
|
-
# Represents a paginated list of monitors from the Exa API
|
|
6
|
-
class MonitorCollection < Struct.new(
|
|
7
|
-
:data,
|
|
8
|
-
:has_more,
|
|
9
|
-
:next_cursor,
|
|
10
|
-
keyword_init: true
|
|
11
|
-
)
|
|
12
|
-
def initialize(data:, has_more: false, next_cursor: nil)
|
|
13
|
-
super
|
|
14
|
-
freeze
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def empty?
|
|
18
|
-
data.empty?
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def to_h
|
|
22
|
-
{
|
|
23
|
-
data: data,
|
|
24
|
-
has_more: has_more,
|
|
25
|
-
next_cursor: next_cursor
|
|
26
|
-
}
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
module Exa
|
|
2
|
-
module Resources
|
|
3
|
-
# Represents a monitor run execution
|
|
4
|
-
MonitorRun = Struct.new(
|
|
5
|
-
:id,
|
|
6
|
-
:object,
|
|
7
|
-
:monitor_id,
|
|
8
|
-
:status,
|
|
9
|
-
:created_at,
|
|
10
|
-
:updated_at,
|
|
11
|
-
:completed_at,
|
|
12
|
-
:failed_at,
|
|
13
|
-
:failed_reason,
|
|
14
|
-
keyword_init: true
|
|
15
|
-
) do
|
|
16
|
-
def freeze
|
|
17
|
-
super
|
|
18
|
-
self
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def pending?
|
|
22
|
-
status == "pending"
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def running?
|
|
26
|
-
status == "running"
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def completed?
|
|
30
|
-
status == "completed"
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def failed?
|
|
34
|
-
status == "failed"
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def to_h
|
|
38
|
-
{
|
|
39
|
-
id: id,
|
|
40
|
-
object: object,
|
|
41
|
-
monitor_id: monitor_id,
|
|
42
|
-
status: status,
|
|
43
|
-
created_at: created_at,
|
|
44
|
-
updated_at: updated_at,
|
|
45
|
-
completed_at: completed_at,
|
|
46
|
-
failed_at: failed_at,
|
|
47
|
-
failed_reason: failed_reason
|
|
48
|
-
}.compact
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Exa
|
|
4
|
-
module Resources
|
|
5
|
-
# Represents a paginated list of monitor runs from the Exa API
|
|
6
|
-
class MonitorRunCollection < Struct.new(
|
|
7
|
-
:data,
|
|
8
|
-
:has_more,
|
|
9
|
-
:next_cursor,
|
|
10
|
-
keyword_init: true
|
|
11
|
-
)
|
|
12
|
-
def initialize(data:, has_more: false, next_cursor: nil)
|
|
13
|
-
super
|
|
14
|
-
freeze
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def empty?
|
|
18
|
-
data.empty?
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def to_h
|
|
22
|
-
{
|
|
23
|
-
data: data,
|
|
24
|
-
has_more: has_more,
|
|
25
|
-
next_cursor: next_cursor
|
|
26
|
-
}
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
module Exa
|
|
2
|
-
module Resources
|
|
3
|
-
class ResearchTask < Struct.new(
|
|
4
|
-
:research_id, :created_at, :status, :model, :instructions,
|
|
5
|
-
:output_schema, :events, :output, :cost_dollars, :finished_at,
|
|
6
|
-
:error, keyword_init: true
|
|
7
|
-
)
|
|
8
|
-
def initialize(research_id:, created_at:, status:, instructions:, model: nil, output_schema: nil, events: nil, output: nil, cost_dollars: nil, finished_at: nil, error: nil)
|
|
9
|
-
super
|
|
10
|
-
freeze
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def pending? = status == 'pending'
|
|
14
|
-
def running? = status == 'running'
|
|
15
|
-
def completed? = status == 'completed'
|
|
16
|
-
def failed? = status == 'failed'
|
|
17
|
-
def canceled? = status == 'canceled'
|
|
18
|
-
|
|
19
|
-
def finished? = !running? && !pending?
|
|
20
|
-
|
|
21
|
-
def to_h
|
|
22
|
-
result = {
|
|
23
|
-
research_id: research_id,
|
|
24
|
-
created_at: created_at,
|
|
25
|
-
status: status,
|
|
26
|
-
instructions: instructions
|
|
27
|
-
}
|
|
28
|
-
result[:model] = model if model
|
|
29
|
-
result[:output_schema] = output_schema if output_schema
|
|
30
|
-
result[:events] = events if events
|
|
31
|
-
result[:output] = output if output
|
|
32
|
-
result[:cost_dollars] = cost_dollars if cost_dollars
|
|
33
|
-
result[:finished_at] = finished_at if finished_at
|
|
34
|
-
result[:error] = error if error
|
|
35
|
-
result
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|