synoppy 1.0.0 → 1.1.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/lib/synoppy.rb +27 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7519c818414f7a03095c989f2ad280cdbe92807c3bf1abaa9fdc3647cbf3970a
|
|
4
|
+
data.tar.gz: 7db8a573fd92b05120572edee8975e9752d63427f5d7f1c3a4d72230d9fa0440
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6a650c618bb9a44027d52f4a9cda0635b8faf8f71d3e3a779c6cb2d6baef11bd15057ea8fba16088118b1855fc6e5535852056b14612a93976c40a2827a6ae5f
|
|
7
|
+
data.tar.gz: d9df436ee8a53b639d9524a1b1b971e32a3faf956222d78880294584489e18037cdaef1434e49443e95c7bbbf026b4ec82987b4b5c871864512d6c5d284cd508
|
data/lib/synoppy.rb
CHANGED
|
@@ -6,7 +6,7 @@ require "uri"
|
|
|
6
6
|
|
|
7
7
|
# Official Ruby SDK for the Synoppy web-data API.
|
|
8
8
|
module Synoppy
|
|
9
|
-
VERSION = "1.
|
|
9
|
+
VERSION = "1.1.0"
|
|
10
10
|
DEFAULT_BASE_URL = "https://synoppy.com"
|
|
11
11
|
|
|
12
12
|
# Raised when the API returns an error response.
|
|
@@ -93,13 +93,16 @@ module Synoppy
|
|
|
93
93
|
#
|
|
94
94
|
# prompt: natural-language instruction describing the JSON to return.
|
|
95
95
|
# `instruction:` is accepted as an alias for `prompt:`.
|
|
96
|
+
# schema: optional JSON Schema (a Hash) to constrain the output shape.
|
|
97
|
+
# When provided, `data` conforms to it.
|
|
96
98
|
#
|
|
97
99
|
# Returns { success, url, model, data, metadata, truncated,
|
|
98
100
|
# usage:{ inputTokens, outputTokens }, latencyMs, creditsUsed, creditsRemaining }.
|
|
99
|
-
def extract(url, prompt: nil, instruction: nil)
|
|
101
|
+
def extract(url, prompt: nil, instruction: nil, schema: nil)
|
|
100
102
|
body = { url: url }
|
|
101
103
|
prompt ||= instruction
|
|
102
104
|
body[:prompt] = prompt unless prompt.nil?
|
|
105
|
+
body[:schema] = schema unless schema.nil?
|
|
103
106
|
request("/api/extract", body)
|
|
104
107
|
end
|
|
105
108
|
|
|
@@ -146,6 +149,28 @@ module Synoppy
|
|
|
146
149
|
request("/api/images", { url: url })
|
|
147
150
|
end
|
|
148
151
|
|
|
152
|
+
# Web search -> clean, ranked results (requires a key).
|
|
153
|
+
#
|
|
154
|
+
# query : the search query (required).
|
|
155
|
+
# max_results : number of results to return (1-15).
|
|
156
|
+
# markdown : also read each result to clean markdown, in one trip (boolean).
|
|
157
|
+
# include_domains: only return results from these domains (array of strings).
|
|
158
|
+
# exclude_domains: never return results from these domains (array of strings).
|
|
159
|
+
# fanout : expand the query into variations for higher recall (boolean,
|
|
160
|
+
# costs more).
|
|
161
|
+
#
|
|
162
|
+
# Returns { success, query, results:[{ title, url, snippet, markdown? }],
|
|
163
|
+
# latencyMs, creditsUsed, creditsRemaining }.
|
|
164
|
+
def search(query, max_results: nil, markdown: nil, include_domains: nil, exclude_domains: nil, fanout: nil)
|
|
165
|
+
body = { query: query }
|
|
166
|
+
body[:maxResults] = max_results unless max_results.nil?
|
|
167
|
+
body[:markdown] = markdown unless markdown.nil?
|
|
168
|
+
body[:includeDomains] = include_domains unless include_domains.nil?
|
|
169
|
+
body[:excludeDomains] = exclude_domains unless exclude_domains.nil?
|
|
170
|
+
body[:fanout] = fanout unless fanout.nil?
|
|
171
|
+
request("/api/search", body)
|
|
172
|
+
end
|
|
173
|
+
|
|
149
174
|
# Take actions on a page (click, type, navigate). Coming soon —
|
|
150
175
|
# /api/act is not live yet.
|
|
151
176
|
def act(*)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: synoppy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Saanora
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Scrape, screenshot, crawl, map, extract, classify, enrich, and images
|
|
14
14
|
— one key for the whole web.
|