old-agentic
Travis Fischer 2024-05-26 20:15:17 -05:00
rodzic b741ac908b
commit e7c4528d3b
3 zmienionych plików z 131 dodań i 121 usunięć

Wyświetl plik

@ -4,8 +4,7 @@ import 'dotenv/config'
import { gracefulExit } from 'exit-hook' import { gracefulExit } from 'exit-hook'
import restoreCursor from 'restore-cursor' import restoreCursor from 'restore-cursor'
import { SearxngClient } from '../src/services/searxng-client.js' // import { SearxngClient } from '../src/services/searxng-client.js'
// import { ClearbitClient } from '../src/index.js' // import { ClearbitClient } from '../src/index.js'
// import { ProxycurlClient } from '../src/services/proxycurl-client.js' // import { ProxycurlClient } from '../src/services/proxycurl-client.js'
// import { WikipediaClient } from '../src/services/wikipedia-client.js' // import { WikipediaClient } from '../src/services/wikipedia-client.js'
@ -25,7 +24,6 @@ async function main() {
// const proxycurl = new ProxycurlClient() // const proxycurl = new ProxycurlClient()
// const res = await proxycurl.getLinkedInPerson({ // const res = await proxycurl.getLinkedInPerson({
// linkedin_profile_url: 'https://linkedin.com/in/fisch2' // linkedin_profile_url: 'https://linkedin.com/in/fisch2'
// // personal_email: 'fisch0920@gmail.com'
// }) // })
// console.log(JSON.stringify(res, null, 2)) // console.log(JSON.stringify(res, null, 2))
@ -35,12 +33,12 @@ async function main() {
// }) // })
// console.log(JSON.stringify(res, null, 2)) // console.log(JSON.stringify(res, null, 2))
const searxng = new SearxngClient() // const searxng = new SearxngClient()
const res = await searxng.search({ // const res = await searxng.search({
query: '4 + 2 * 10' // query: 'golden gate bridge',
// engines: ['google'] // engines: ['reddit']
}) // })
console.log(JSON.stringify(res, null, 2)) // console.log(JSON.stringify(res, null, 2))
return gracefulExit(0) return gracefulExit(0)
} }

Wyświetl plik

@ -101,7 +101,10 @@ export namespace perigon {
export type ArticlesResponse = { export type ArticlesResponse = {
status: number status: number
numResults: number numResults: number
articles: { articles: Article[]
}
export type Article = {
url: string url: string
authorsByline: string authorsByline: string
articleId: string articleId: string
@ -151,13 +154,13 @@ export namespace perigon {
reprint: boolean reprint: boolean
reprintGroupId: string reprintGroupId: string
places: null places: null
}[]
} }
export type StoriesOptions = { export type StoriesOptions = {
clusterId?: string clusterId?: string
topic?: string topic?: string
category?: Categories category?: Categories
q?: string
name?: string name?: string
nameExists?: boolean nameExists?: boolean
from?: string from?: string
@ -180,7 +183,10 @@ export namespace perigon {
export type StoriesResponse = { export type StoriesResponse = {
status: number status: number
numResults: number numResults: number
results: Array<{ results: Story[]
}
export type Story = {
createdAt: string createdAt: string
updatedAt: string updatedAt: string
initializedAt: string initializedAt: string
@ -243,10 +249,12 @@ export namespace perigon {
area?: string area?: string
county?: string county?: string
}> }>
}>
} }
} }
/**
* @see https://www.goperigon.com
*/
export class PerigonClient { export class PerigonClient {
readonly ky: KyInstance readonly ky: KyInstance
readonly apiKey: string readonly apiKey: string
@ -264,7 +272,7 @@ export class PerigonClient {
timeoutMs?: number timeoutMs?: number
ky?: KyInstance ky?: KyInstance
} = {}) { } = {}) {
assert(apiKey, 'Error perigon client missing required "apiKey"') assert(apiKey, 'Error PerigonClient missing required "apiKey"')
this.apiKey = apiKey this.apiKey = apiKey

Wyświetl plik

@ -241,6 +241,10 @@ export namespace searxng {
/** /**
* @see https://docs.searxng.org * @see https://docs.searxng.org
*
* NOTE: You'll need to run a local instance of Searxng to use this client.
*
* See [perplexica](https://github.com/ItzCrazyKns/Perplexica/blob/master/docker-compose.yaml) for an example.
*/ */
export class SearxngClient { export class SearxngClient {
readonly ky: KyInstance readonly ky: KyInstance