old-agentic
Travis Fischer 2024-06-02 21:59:08 -05:00
rodzic 5ecfdc6f7c
commit 1e2aedaaab
9 zmienionych plików z 31 dodań i 13 usunięć

Wyświetl plik

@ -5,9 +5,9 @@ import type { DeepNullable, KyInstance } from '../types.js'
import { assert, delay, getEnv, throttleKy } from '../utils.js' import { assert, delay, getEnv, throttleKy } from '../utils.js'
export namespace clearbit { export namespace clearbit {
// Allow up to 20 requests per minute by default. // Allow up to 600 requests per minute by default.
export const throttle = pThrottle({ export const throttle = pThrottle({
limit: 20, limit: 600,
interval: 60 * 1000 interval: 60 * 1000
}) })
@ -535,7 +535,8 @@ export class ClearbitClient {
this.ky = throttledKy.extend({ this.ky = throttledKy.extend({
timeout: timeoutMs, timeout: timeoutMs,
headers: { headers: {
Authorization: `Basic ${Buffer.from(`${apiKey}:`).toString('base64')}` // Authorization: `Basic ${Buffer.from(`${apiKey}:`).toString('base64')}`
Authorization: `Bearer ${apiKey}`
} }
}) })
} }
@ -546,7 +547,6 @@ export class ClearbitClient {
searchParams: { ...options } searchParams: { ...options }
}) })
.json<clearbit.CompanyResponse>() .json<clearbit.CompanyResponse>()
.catch((_) => undefined)
} }
async companySearch(options: clearbit.CompanySearchOptions) { async companySearch(options: clearbit.CompanySearchOptions) {
@ -642,7 +642,7 @@ export class ClearbitClient {
.catch((_) => undefined) .catch((_) => undefined)
} }
async revealCompanyFromIp(ip: string) { async revealCompanyFromIP(ip: string) {
return this.ky return this.ky
.get('https://reveal.clearbit.com/v1/companies/find', { .get('https://reveal.clearbit.com/v1/companies/find', {
searchParams: { ip } searchParams: { ip }

Wyświetl plik

@ -19,7 +19,10 @@ export class DexaClient {
timeoutMs?: number timeoutMs?: number
ky?: KyInstance ky?: KyInstance
} = {}) { } = {}) {
assert(apiKey, 'DexaClient missing required "apiKey"') assert(
apiKey,
'DexaClient missing required "apiKey" (defaults to "DEXA_API_KEY")'
)
this.apiKey = apiKey this.apiKey = apiKey
this.apiBaseUrl = apiBaseUrl this.apiBaseUrl = apiBaseUrl

Wyświetl plik

@ -351,7 +351,10 @@ export class DiffbotClient {
throttle?: boolean throttle?: boolean
ky?: KyInstance ky?: KyInstance
} = {}) { } = {}) {
assert(apiKey, `DiffbotClient missing required "apiKey"`) assert(
apiKey,
`DiffbotClient missing required "apiKey" (defaults to "DIFFBOT_API_KEY")`
)
this.apiKey = apiKey this.apiKey = apiKey
this.apiBaseUrl = apiBaseUrl this.apiBaseUrl = apiBaseUrl

Wyświetl plik

@ -143,7 +143,10 @@ export class ExaClient {
apiBaseUrl?: string apiBaseUrl?: string
ky?: KyInstance ky?: KyInstance
} = {}) { } = {}) {
assert(apiKey, 'ExaClient missing required "apiKey"') assert(
apiKey,
'ExaClient missing required "apiKey" (defaults to "EXA_API_KEY")'
)
this.apiKey = apiKey this.apiKey = apiKey
this.apiBaseUrl = apiBaseUrl this.apiBaseUrl = apiBaseUrl

Wyświetl plik

@ -449,7 +449,10 @@ export class PeopleDataLabsClient {
throttle?: boolean throttle?: boolean
ky?: KyInstance ky?: KyInstance
} = {}) { } = {}) {
assert(apiKey, 'PeopleDataLabsClient missing required "apiKey"') assert(
apiKey,
'PeopleDataLabsClient missing required "apiKey" (defaults to "PEOPLE_DATA_LABS_API_KEY")'
)
this.apiKey = apiKey this.apiKey = apiKey
this.apiBaseUrl = apiBaseUrl this.apiBaseUrl = apiBaseUrl

Wyświetl plik

@ -273,7 +273,10 @@ export class PerigonClient {
timeoutMs?: number timeoutMs?: number
ky?: KyInstance ky?: KyInstance
} = {}) { } = {}) {
assert(apiKey, 'Error PerigonClient missing required "apiKey"') assert(
apiKey,
'PerigonClient missing required "apiKey" (defaults to "PERIGON_API_KEY")'
)
this.apiKey = apiKey this.apiKey = apiKey

Wyświetl plik

@ -7,7 +7,7 @@ import { assert, getEnv, throttleKy } from '../utils.js'
// All proxycurl types are auto-generated from their openapi spec // All proxycurl types are auto-generated from their openapi spec
export namespace proxycurl { export namespace proxycurl {
// Allow up to 1500 requests per minute by default. // Allow up to 300 requests per minute by default (enforced at 5 minute intervals).
export const throttle = pThrottle({ export const throttle = pThrottle({
limit: 1500, limit: 1500,
interval: 5 * 60 * 1000 interval: 5 * 60 * 1000

Wyświetl plik

@ -649,7 +649,10 @@ export class SerpAPIClient extends AIFunctionsProvider {
apiBaseUrl?: string apiBaseUrl?: string
ky?: KyInstance ky?: KyInstance
} & serpapi.ClientParams = {}) { } & serpapi.ClientParams = {}) {
assert(apiKey, 'Error SerpAPIClient missing required "apiKey"') assert(
apiKey,
'SerpAPIClient missing required "apiKey" (defaults to "SERPAPI_API_KEY")'
)
super() super()
this.apiKey = apiKey this.apiKey = apiKey

Wyświetl plik

@ -227,7 +227,7 @@ export class SerperClient extends AIFunctionsProvider {
} & serper.ClientParams = {}) { } & serper.ClientParams = {}) {
assert( assert(
apiKey, apiKey,
'SerperClient missing required "apiKey" (defaults to "SERPER_API_KEY" env var)' 'SerperClient missing required "apiKey" (defaults to "SERPER_API_KEY")'
) )
super() super()