@graphai/serper_agent 0.0.1

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 ADDED
@@ -0,0 +1,2 @@
1
+ # GraphAI Agent
2
+ serper agent
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import serperAgent from "./serper_agent";
2
+ export { serperAgent };
package/lib/index.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.serperAgent = void 0;
7
+ const serper_agent_1 = __importDefault(require("./serper_agent"));
8
+ exports.serperAgent = serper_agent_1.default;
@@ -0,0 +1,4 @@
1
+ import { AgentFunction, AgentFunctionInfo } from "graphai";
2
+ export declare const serperAgent: AgentFunction;
3
+ declare const serperAgentInfo: AgentFunctionInfo;
4
+ export default serperAgentInfo;
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.serperAgent = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const serperAgent = async ({ namedInputs }) => {
9
+ const apiKey = process.env.SERPER_API_KEY ?? "";
10
+ const { query } = namedInputs;
11
+ const data = JSON.stringify({
12
+ q: query,
13
+ });
14
+ const config = {
15
+ method: "post",
16
+ maxBodyLength: Infinity,
17
+ url: "https://google.serper.dev/search",
18
+ headers: {
19
+ "X-API-KEY": apiKey,
20
+ "Content-Type": "application/json",
21
+ },
22
+ data: data,
23
+ };
24
+ try {
25
+ const response = await axios_1.default.request(config);
26
+ return response.data;
27
+ }
28
+ catch (error) {
29
+ console.log(error);
30
+ }
31
+ };
32
+ exports.serperAgent = serperAgent;
33
+ const serperAgentInfo = {
34
+ name: "serperAgent",
35
+ agent: exports.serperAgent,
36
+ mock: exports.serperAgent,
37
+ samples: [
38
+ {
39
+ params: {},
40
+ inputs: { query: "apple inc" },
41
+ result: {
42
+ searchParameters: {
43
+ q: "apple inc",
44
+ type: "search",
45
+ engine: "google",
46
+ },
47
+ knowledgeGraph: {
48
+ title: "Apple",
49
+ type: "Technology company",
50
+ website: "http://www.apple.com/",
51
+ imageUrl: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQwGQRv5TjjkycpctY66mOg_e2-npacrmjAb6_jAWhzlzkFE3OTjxyzbA&s=0",
52
+ description: "Apple Inc. is an American multinational corporation and technology company headquartered and incorporated in Cupertino, California, in Silicon Valley. It is best known for its consumer electronics, software, and services.",
53
+ descriptionSource: "Wikipedia",
54
+ descriptionLink: "https://en.wikipedia.org/wiki/Apple_Inc.",
55
+ attributes: {
56
+ "Customer service": "1 (800) 275-2273",
57
+ Founders: "Steve Jobs, Steve Wozniak, and Ronald Wayne",
58
+ Headquarters: "Cupertino, CA",
59
+ CEO: "Tim Cook (Aug 24, 2011–)",
60
+ CFO: "Luca Maestri",
61
+ Founded: "April 1, 1976, Los Altos, CA",
62
+ },
63
+ },
64
+ organic: [
65
+ {
66
+ title: "Apple",
67
+ link: "https://www.apple.com/",
68
+ snippet: "Discover the innovative world of Apple and shop everything iPhone, iPad, Apple Watch, Mac, and Apple TV, plus explore accessories, entertainment, ...",
69
+ sitelinks: [
70
+ {
71
+ title: "Support",
72
+ link: "https://support.apple.com/",
73
+ },
74
+ {
75
+ title: "Careers at Apple",
76
+ link: "https://www.apple.com/careers/us/",
77
+ },
78
+ {
79
+ title: "Contact Apple",
80
+ link: "https://www.apple.com/contact/",
81
+ },
82
+ {
83
+ title: "Store",
84
+ link: "https://www.apple.com/store",
85
+ },
86
+ {
87
+ title: "Investor Relations",
88
+ link: "https://investor.apple.com/investor-relations/default.aspx",
89
+ },
90
+ ],
91
+ position: 1,
92
+ },
93
+ {
94
+ title: "Apple Inc. - Wikipedia",
95
+ link: "https://en.wikipedia.org/wiki/Apple_Inc.",
96
+ snippet: "Apple Inc. is an American multinational corporation and technology company headquartered and incorporated in Cupertino, California, in Silicon Valley.",
97
+ sitelinks: [
98
+ {
99
+ title: "History",
100
+ link: "https://en.wikipedia.org/wiki/History_of_Apple_Inc.",
101
+ },
102
+ {
103
+ title: "List of Apple products",
104
+ link: "https://en.wikipedia.org/wiki/List_of_Apple_products",
105
+ },
106
+ {
107
+ title: "Litigation involving Apple Inc.",
108
+ link: "https://en.wikipedia.org/wiki/Litigation_involving_Apple_Inc.",
109
+ },
110
+ {
111
+ title: "Apple Park",
112
+ link: "https://en.wikipedia.org/wiki/Apple_Park",
113
+ },
114
+ ],
115
+ position: 2,
116
+ },
117
+ {
118
+ title: "Apple Inc. | History, Products, Headquarters, & Facts - Britannica",
119
+ link: "https://www.britannica.com/money/Apple-Inc",
120
+ snippet: "Apple Inc. is an American multinational technology company that revolutionized the technology sector through its innovation of computer software, ...",
121
+ position: 3,
122
+ },
123
+ {
124
+ title: "Apple Inc. (AAPL) Company Profile & Facts - Yahoo Finance",
125
+ link: "https://finance.yahoo.com/quote/AAPL/profile/",
126
+ snippet: "(408) 996-1010 https://www.apple.com. Sector: Technology. Industry: Consumer Electronics. Full Time Employees: 164,000. Description. Apple Inc. designs ...",
127
+ position: 4,
128
+ },
129
+ {
130
+ title: "AAPL: Apple Inc Stock Price Quote - NASDAQ GS - Bloomberg",
131
+ link: "https://www.bloomberg.com/quote/AAPL:US",
132
+ snippet: "Stock analysis for Apple Inc (AAPL:NASDAQ GS) including stock price, stock chart, company news, key statistics, fundamentals and company profile.",
133
+ position: 5,
134
+ },
135
+ {
136
+ title: "Apple Inc. (AAPL) Stock Price Today - WSJ",
137
+ link: "https://www.wsj.com/market-data/quotes/AAPL",
138
+ snippet: "Apple Inc. engages in the design, manufacture, and sale of smartphones, personal computers, tablets, wearables and accessories, and other varieties of related ...",
139
+ position: 6,
140
+ },
141
+ {
142
+ title: "Apple Inc. (AAPL) Stock Price, News, Quote & History - Yahoo Finance",
143
+ link: "https://finance.yahoo.com/quote/AAPL/",
144
+ snippet: "Apple Inc. designs, manufactures, and markets smartphones, personal computers, tablets, wearables, and accessories worldwide. The company offers iPhone, ...",
145
+ sitelinks: [
146
+ {
147
+ title: "Profile",
148
+ link: "https://finance.yahoo.com/quote/AAPL/profile/",
149
+ },
150
+ {
151
+ title: "Statistics",
152
+ link: "https://finance.yahoo.com/quote/AAPL/key-statistics/",
153
+ },
154
+ {
155
+ title: "Chart",
156
+ link: "https://finance.yahoo.com/quote/AAPL/chart/",
157
+ },
158
+ {
159
+ title: "News",
160
+ link: "https://finance.yahoo.com/quote/AAPL/news/",
161
+ },
162
+ ],
163
+ position: 7,
164
+ },
165
+ ],
166
+ peopleAlsoAsk: [
167
+ {
168
+ question: "What is the Apple Inc?",
169
+ snippet: '"Inc." in Apple Inc. stands for "Incorporated".',
170
+ title: "What does the 'Inc.' in Apple Inc. mean? - Quora",
171
+ link: "https://www.quora.com/What-does-the-Inc-in-Apple-Inc-mean",
172
+ },
173
+ {
174
+ question: "Who owns Apple Inc?",
175
+ snippet: "Apple (AAPL) Ownership Overview The ownership structure of Apple (AAPL) stock is a mix of institutional, retail, and individual investors. Approximately 49.07% of the company's stock is owned by Institutional Investors, 0.06% is owned by Insiders, and 50.87% is owned by Public Companies and Individual Investors.",
176
+ title: "Who owns Apple? AAPL Stock Ownership - TipRanks.com",
177
+ link: "https://www.tipranks.com/stocks/aapl/ownership",
178
+ },
179
+ {
180
+ question: "Why did Apple change to Apple Inc?",
181
+ snippet: "During his keynote speech at the Macworld Expo on January 9, 2007, Jobs announced the renaming of Apple Computer, Inc. to Apple Inc., because the company had broadened its focus from computers to consumer electronics. This event also saw the announcement of the iPhone and the Apple TV.",
182
+ title: "Apple Inc. - Wikipedia",
183
+ link: "https://en.wikipedia.org/wiki/Apple_Inc.",
184
+ },
185
+ {
186
+ question: "What is Apple Inc known for?",
187
+ snippet: "Apple Inc. is an American multinational technology company that revolutionized the technology sector through its innovation of computer software, personal computers, mobile tablets, smartphones, and computer peripherals.",
188
+ title: "Apple Inc. | History, Products, Headquarters, & Facts - Britannica",
189
+ link: "https://www.britannica.com/money/Apple-Inc",
190
+ },
191
+ ],
192
+ relatedSearches: [
193
+ {
194
+ query: "Find My iPhone",
195
+ },
196
+ {
197
+ query: "apple inc คืออะไร",
198
+ },
199
+ {
200
+ query: "Apple Inc full form",
201
+ },
202
+ {
203
+ query: "Apple company history",
204
+ },
205
+ {
206
+ query: "Apple company owner",
207
+ },
208
+ {
209
+ query: "Apple Inc website",
210
+ },
211
+ {
212
+ query: "Apple Inc usa",
213
+ },
214
+ {
215
+ query: "Apple Inc address",
216
+ },
217
+ {
218
+ query: "Apple Inc industry",
219
+ },
220
+ ],
221
+ credits: 1,
222
+ },
223
+ },
224
+ ],
225
+ description: "serper agent",
226
+ category: ["net"],
227
+ author: "isamu arimoto",
228
+ repository: "https://github.com/isamu/graphai-agents",
229
+ license: "MIT",
230
+ environmentVariables: ["SERPER_API_KEY"],
231
+ };
232
+ exports.default = serperAgentInfo;
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@graphai/serper_agent",
3
+ "version": "0.0.1",
4
+ "description": "serper agent",
5
+ "main": "lib/index.js",
6
+ "files": [
7
+ "./lib"
8
+ ],
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "eslint": "eslint src --fix",
12
+ "format": "prettier --write '{src,tests}/**/*.ts'",
13
+ "doc": "npx agentdoc",
14
+ "test_run": "node --test --require ts-node/register ./tests/run_*.ts",
15
+ "test": "node --test --require ts-node/register ./tests/test_*.ts",
16
+ "ci": "yarn run format && yarn run eslint && yarn run test && yarn run build"
17
+ },
18
+ "author": "isamu arimoto",
19
+ "license": "MIT",
20
+ "devDependencies": {},
21
+ "dependencies": {},
22
+ "types": "./lib/index.d.ts",
23
+ "directories": {
24
+ "lib": "lib"
25
+ }
26
+ }