xapi-to 0.1.19 → 0.1.20
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.
- package/README.md +208 -1
- package/dist/chunk-TYY6JR6O.js +870 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +998 -670
- package/dist/openai-sandbox-client.d.ts +85 -0
- package/dist/openai-sandbox-client.js +285 -0
- package/examples/openai-agents-sandbox-local.ts +131 -0
- package/examples/sandbox-api-cli-openai.mjs +450 -0
- package/package.json +25 -3
- package/scripts/openai-sandbox-agent-e2e.ts +219 -0
- package/scripts/sandbox-playground-e2e.mjs +463 -0
- package/skills/xapi/SKILL.md +18 -5
- package/skills/xapi/guides/linkedin.md +55 -0
- package/skills/xapi/guides/sandbox.md +466 -0
- package/skills/xapi/guides/serper.md +124 -0
- package/src/client.ts +664 -0
- package/src/config.ts +160 -0
- package/src/openai-sandbox-client.ts +349 -0
- package/src/sandbox-client.ts +289 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Serper Guide
|
|
2
|
+
|
|
3
|
+
Use the direct `serper.*` API actions when the task needs provider-native
|
|
4
|
+
Google results, several searches in one mini-batch, or Serper surfaces that the
|
|
5
|
+
built-in `web.search.*` capabilities do not expose. For a simple single search
|
|
6
|
+
with a normalized xAPI response, prefer `web.search.*` and read
|
|
7
|
+
`google_search.md` instead.
|
|
8
|
+
|
|
9
|
+
The current `serper` service exposes 12 v7 actions. They are third-party API
|
|
10
|
+
actions, so parameters go inside `body`:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npx xapi-to get serper.search
|
|
14
|
+
npx xapi-to call serper.search --input '{"body":{"q":"OpenAI","gl":"us","hl":"en"}}'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Run `get` before relying on optional parameters or response fields. Serper
|
|
18
|
+
responses are passed through in provider-native form and can gain fields that
|
|
19
|
+
are not declared in the xAPI output schema.
|
|
20
|
+
|
|
21
|
+
## Mini-batch
|
|
22
|
+
|
|
23
|
+
Eleven actions accept either one request object or an array of request objects
|
|
24
|
+
in `body`. The response is respectively one result object or an array of result
|
|
25
|
+
objects in request order:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx xapi-to call serper.search --input \
|
|
29
|
+
'{"body":[{"q":"OpenAI","gl":"us","hl":"en"},{"q":"Cloudflare","gl":"us","hl":"en"}]}'
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Each array member has the same shape as a single request. Do not wrap the
|
|
33
|
+
members in `queries`, and do not confuse this with `xapi-to get-batch`, which
|
|
34
|
+
retrieves several Action schemas without executing them.
|
|
35
|
+
|
|
36
|
+
`serper.reviews` is the only current `serper.*` action that does not support
|
|
37
|
+
mini-batch. Send exactly one object in its `body`.
|
|
38
|
+
|
|
39
|
+
## Billing
|
|
40
|
+
|
|
41
|
+
All 12 actions use dynamic xAPI billing at **$0.002 per Serper credit**. For a
|
|
42
|
+
single request, the charge is `response.credits * $0.002`; for a mini-batch it
|
|
43
|
+
is `sum(response[*].credits) * $0.002`.
|
|
44
|
+
|
|
45
|
+
The `cost: 0` placeholder shown in discovery output does not mean the call is
|
|
46
|
+
free; dynamic prices are not comparable as a fixed per-call price. Inspect the
|
|
47
|
+
Action's `meta.description` and `meta.pricing`, and keep returned `credits` when
|
|
48
|
+
auditing usage.
|
|
49
|
+
|
|
50
|
+
## Current Actions
|
|
51
|
+
|
|
52
|
+
| Action | Use it for | Primary input |
|
|
53
|
+
|---|---|---|
|
|
54
|
+
| `serper.search` | General Google web results | `q` |
|
|
55
|
+
| `serper.images` | Google Images; current schema accepts `num` 10 or 100 | `q` |
|
|
56
|
+
| `serper.news` | Google News results | `q` |
|
|
57
|
+
| `serper.videos` | Google video results | `q` |
|
|
58
|
+
| `serper.shopping` | Product and shopping results | `q` |
|
|
59
|
+
| `serper.scholar` | Academic publications and citations | `q` |
|
|
60
|
+
| `serper.patents` | Patent search | `q` |
|
|
61
|
+
| `serper.autocomplete` | Suggestions for a partial query | `q` |
|
|
62
|
+
| `serper.places` | Local businesses and place search | `q` |
|
|
63
|
+
| `serper.maps` | Map search or lookup by Google Place ID/CID | `q`, `placeId`, or `cid` |
|
|
64
|
+
| `serper.lens` | Reverse image search from a public image URL | `url` |
|
|
65
|
+
| `serper.reviews` | Place reviews and cursor pagination | `placeId`, `cid`, or `fid` |
|
|
66
|
+
|
|
67
|
+
The common search-family controls are `gl`, `hl`, `location`, `page`, `num`,
|
|
68
|
+
`tbs`, and `autocorrect`, but not every action exposes every control. Use the
|
|
69
|
+
current `get` schema instead of copying parameters between actions.
|
|
70
|
+
|
|
71
|
+
## Focused Examples
|
|
72
|
+
|
|
73
|
+
### News with a Google time filter
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npx xapi-to call serper.news --input \
|
|
77
|
+
'{"body":{"q":"AI regulation","gl":"us","hl":"en","tbs":"qdr:d"}}'
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Maps by coordinates
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npx xapi-to call serper.maps --input \
|
|
84
|
+
'{"body":{"q":"coffee","ll":"@40.7455096,-74.0083012,14z","hl":"en"}}'
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Use `placeId` or `cid` instead of `q` when resolving a known Google place.
|
|
88
|
+
|
|
89
|
+
### Google Lens
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npx xapi-to call serper.lens --input \
|
|
93
|
+
'{"body":{"url":"https://example.com/public-image.jpg","gl":"us","hl":"en"}}'
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The image must be reachable through a public URL; a local filesystem path is
|
|
97
|
+
not a valid Lens input.
|
|
98
|
+
|
|
99
|
+
### Reviews and pagination
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# First page; body must be an object, not an array
|
|
103
|
+
npx xapi-to call serper.reviews --input \
|
|
104
|
+
'{"body":{"placeId":"ChIJ...","sortBy":"newest","gl":"us","hl":"en"}}'
|
|
105
|
+
|
|
106
|
+
# Continue with the provider's cursor
|
|
107
|
+
npx xapi-to call serper.reviews --input \
|
|
108
|
+
'{"body":{"placeId":"ChIJ...","nextPageToken":"<token>","sortBy":"newest","gl":"us","hl":"en"}}'
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Current `sortBy` values are `mostRelevant`, `newest`, `highestRating`, and
|
|
112
|
+
`lowestRating`.
|
|
113
|
+
|
|
114
|
+
## Service Boundary
|
|
115
|
+
|
|
116
|
+
Serper's upstream product also advertises webpage extraction, but the current
|
|
117
|
+
xAPI service directory exposes only the 12 `serper.*` actions above. Do not
|
|
118
|
+
invent or call `serper.webpage`. Search the live registry first; if a Webpage
|
|
119
|
+
Action is added later, use its own discovered Action ID and schema because the
|
|
120
|
+
upstream scraper is a separate surface from Google search.
|
|
121
|
+
|
|
122
|
+
For provider details that are not exposed by `xapi-to get`, consult the current
|
|
123
|
+
official Serper documentation at <https://serper.dev/>. xAPI's `body` wrapper,
|
|
124
|
+
Action IDs, and billing metadata remain authoritative for calls through xAPI.
|