exa-ai 0.8.0 → 0.9.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/exe/exa-ai-webset-create +5 -0
- data/exe/exa-ai-webset-update +11 -8
- data/lib/exa/cli/formatters/webset_formatter.rb +2 -0
- data/lib/exa/client.rb +2 -1
- data/lib/exa/services/websets/create_validator.rb +7 -0
- data/lib/exa/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 192ebafa0e355cadad770196faef4841992b4f9ea9f115526edd09b26ef786ec
|
|
4
|
+
data.tar.gz: 01c5dfd469dceea4108ba22a91ba2f03941908a3509b6241f4b0e0e63f3e09e9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2bb8c7dcb3c1940ca2ab84eef4a6f08b93f65a23cf86547b2736e0eefd1dbc012d954dca5626f0c723f28d4527de4112cab46972546bb725c01f0ad0946a6e3e
|
|
7
|
+
data.tar.gz: 3b232fe9fa3a95aa86553825373f2b6596910edc84144af3995486c90a96f6f6ea92590cda6420b2069e2dee9a5173b61089bc32257ec1ab22158eaa39ad2fa8
|
data/exe/exa-ai-webset-create
CHANGED
|
@@ -61,6 +61,9 @@ def parse_args(argv)
|
|
|
61
61
|
when "--external-id"
|
|
62
62
|
args[:external_id] = argv[i + 1]
|
|
63
63
|
i += 2
|
|
64
|
+
when "--title"
|
|
65
|
+
args[:title] = argv[i + 1]
|
|
66
|
+
i += 2
|
|
64
67
|
when "--metadata"
|
|
65
68
|
args[:metadata] = parse_json_or_file(argv[i + 1])
|
|
66
69
|
i += 2
|
|
@@ -93,6 +96,7 @@ def parse_args(argv)
|
|
|
93
96
|
--exclude JSON Sources to exclude from searches (supports @file.json)
|
|
94
97
|
Format: [{"source":"import|webset","id":"..."}]
|
|
95
98
|
--external-id ID External identifier for the webset
|
|
99
|
+
--title TITLE Title for the webset
|
|
96
100
|
--metadata JSON Custom metadata (supports @file.json)
|
|
97
101
|
Format: {"key":"value"}
|
|
98
102
|
--wait Wait for webset to reach idle status
|
|
@@ -185,6 +189,7 @@ begin
|
|
|
185
189
|
webset_params[:enrichments] = args[:enrichments] if args[:enrichments]
|
|
186
190
|
webset_params[:exclude] = args[:exclude] if args[:exclude]
|
|
187
191
|
webset_params[:externalId] = args[:external_id] if args[:external_id]
|
|
192
|
+
webset_params[:title] = args[:title] if args[:title]
|
|
188
193
|
webset_params[:metadata] = args[:metadata] if args[:metadata]
|
|
189
194
|
|
|
190
195
|
# Create webset
|
data/exe/exa-ai-webset-update
CHANGED
|
@@ -6,6 +6,7 @@ require "json"
|
|
|
6
6
|
|
|
7
7
|
# Parse arguments
|
|
8
8
|
webset_id = nil
|
|
9
|
+
title = nil
|
|
9
10
|
metadata = nil
|
|
10
11
|
api_key = nil
|
|
11
12
|
output_format = "json"
|
|
@@ -45,6 +46,8 @@ args = ARGV.dup
|
|
|
45
46
|
while args.any?
|
|
46
47
|
arg = args.shift
|
|
47
48
|
case arg
|
|
49
|
+
when "--title"
|
|
50
|
+
title = args.shift
|
|
48
51
|
when "--metadata"
|
|
49
52
|
metadata = parse_json_or_file(args.shift)
|
|
50
53
|
when "--api-key"
|
|
@@ -55,12 +58,13 @@ while args.any?
|
|
|
55
58
|
puts <<~HELP
|
|
56
59
|
Usage: exa-ai webset-update <webset_id> [OPTIONS]
|
|
57
60
|
|
|
58
|
-
Update a webset's metadata
|
|
61
|
+
Update a webset's title and/or metadata
|
|
59
62
|
|
|
60
63
|
Arguments:
|
|
61
64
|
webset_id ID of the webset to update (required)
|
|
62
65
|
|
|
63
66
|
Options:
|
|
67
|
+
--title TITLE Title for the webset
|
|
64
68
|
--metadata JSON Custom metadata to update (supports @file.json)
|
|
65
69
|
--api-key KEY Exa API key (or set EXA_API_KEY env var)
|
|
66
70
|
--output-format FMT Output format: json, pretty, or text (default: json)
|
|
@@ -68,6 +72,8 @@ while args.any?
|
|
|
68
72
|
|
|
69
73
|
Examples:
|
|
70
74
|
exa-ai webset-update ws_abc123 --metadata '{"project":"Q1-2025"}'
|
|
75
|
+
exa-ai webset-update ws_abc123 --title "Q1 Research"
|
|
76
|
+
exa-ai webset-update ws_abc123 --title "Q1 Research" --metadata '{"project":"Q1-2025"}'
|
|
71
77
|
exa-ai webset-update ws_abc123 --metadata @metadata.json
|
|
72
78
|
exa-ai webset-update ws_abc123 --metadata '{"tags":["important"]}' --output-format pretty
|
|
73
79
|
HELP
|
|
@@ -91,12 +97,6 @@ if webset_id.nil?
|
|
|
91
97
|
exit 1
|
|
92
98
|
end
|
|
93
99
|
|
|
94
|
-
if metadata.nil?
|
|
95
|
-
$stderr.puts "Error: --metadata is required"
|
|
96
|
-
$stderr.puts "Try 'exa-ai webset-update --help' for more information"
|
|
97
|
-
exit 1
|
|
98
|
-
end
|
|
99
|
-
|
|
100
100
|
begin
|
|
101
101
|
# Resolve API key and format
|
|
102
102
|
api_key = Exa::CLI::Base.resolve_api_key(api_key)
|
|
@@ -106,7 +106,10 @@ begin
|
|
|
106
106
|
client = Exa::CLI::Base.build_client(api_key)
|
|
107
107
|
|
|
108
108
|
# Update webset
|
|
109
|
-
|
|
109
|
+
update_params = {}
|
|
110
|
+
update_params[:title] = title if title
|
|
111
|
+
update_params[:metadata] = metadata if metadata
|
|
112
|
+
webset = client.update_webset(webset_id, **update_params)
|
|
110
113
|
|
|
111
114
|
# Format and output
|
|
112
115
|
output = Exa::CLI::Formatters::WebsetFormatter.format(webset, output_format)
|
|
@@ -38,6 +38,7 @@ module Exa
|
|
|
38
38
|
lines = []
|
|
39
39
|
lines << "Webset: #{webset.id}"
|
|
40
40
|
lines << "Status: #{webset.status}"
|
|
41
|
+
lines << "Title: #{webset.title}" if webset.title
|
|
41
42
|
lines << "Created: #{webset.created_at}" if webset.created_at
|
|
42
43
|
lines << "Updated: #{webset.updated_at}" if webset.updated_at
|
|
43
44
|
|
|
@@ -61,6 +62,7 @@ module Exa
|
|
|
61
62
|
collection.data.each do |ws|
|
|
62
63
|
lines << "\n #{ws['id']}"
|
|
63
64
|
lines << " Status: #{ws['status']}"
|
|
65
|
+
lines << " Title: #{ws['title']}" if ws['title']
|
|
64
66
|
lines << " Created: #{ws['createdAt']}" if ws['createdAt']
|
|
65
67
|
end
|
|
66
68
|
lines.join("\n")
|
data/lib/exa/client.rb
CHANGED
|
@@ -158,10 +158,11 @@ module Exa
|
|
|
158
158
|
Services::Websets::Cancel.new(connection, id: id).call
|
|
159
159
|
end
|
|
160
160
|
|
|
161
|
-
# Update a webset's metadata
|
|
161
|
+
# Update a webset's title and/or metadata
|
|
162
162
|
#
|
|
163
163
|
# @param id [String] Webset ID
|
|
164
164
|
# @param params [Hash] Update parameters
|
|
165
|
+
# @option params [String] :title Title for the webset
|
|
165
166
|
# @option params [Hash] :metadata Metadata to update
|
|
166
167
|
# @return [Resources::Webset] The updated webset
|
|
167
168
|
def update_webset(id, **params)
|
|
@@ -19,6 +19,7 @@ module Exa
|
|
|
19
19
|
validate_enrichments!(params[:enrichments]) if params[:enrichments]
|
|
20
20
|
validate_exclude!(params[:exclude]) if params[:exclude]
|
|
21
21
|
validate_external_id!(params[:externalId]) if params[:externalId]
|
|
22
|
+
validate_title!(params[:title]) if params[:title]
|
|
22
23
|
validate_metadata!(params[:metadata]) if params[:metadata]
|
|
23
24
|
validate_no_duplicate_ids_in_import_and_scope!(params)
|
|
24
25
|
end
|
|
@@ -158,6 +159,12 @@ module Exa
|
|
|
158
159
|
raise ArgumentError, "externalId cannot exceed 300 characters" if external_id.length > 300
|
|
159
160
|
end
|
|
160
161
|
|
|
162
|
+
def validate_title!(title)
|
|
163
|
+
raise ArgumentError, "title must be a String" unless title.is_a?(String)
|
|
164
|
+
raise ArgumentError, "title cannot be empty" if title.strip.empty?
|
|
165
|
+
raise ArgumentError, "title cannot exceed 1000 characters" if title.length > 1000
|
|
166
|
+
end
|
|
167
|
+
|
|
161
168
|
def validate_metadata!(metadata)
|
|
162
169
|
raise ArgumentError, "metadata must be a Hash" unless metadata.is_a?(Hash)
|
|
163
170
|
|
data/lib/exa/version.rb
CHANGED