Skip to content

Commit 678182a

Browse files
committed
allow custom baseUrl
1 parent 4031b83 commit 678182a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Client.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,22 @@ import {
1515
PromptToolBody
1616
} from './types'
1717

18+
const BASE_URL = 'https://api.promptfoundry.ai/sdk/v1'
19+
1820
export default class PromptFoundry {
1921
private client: typeof api
2022

2123
private apiKey: string
2224

23-
constructor({ apiKey }: { apiKey: string }) {
25+
constructor({ apiKey, baseUrl = BASE_URL }: { apiKey: string; baseUrl?: string }) {
2426
// @ts-expect-error - protect against missing apiKey for js consumers
2527
if (apiKey === '' || apiKey === undefined || apiKey === null || apiKey === 0) {
2628
throw new Error('Prompt Foundry API Key is required!')
2729
}
2830

2931
this.apiKey = apiKey
3032

31-
this.client = createApiClient('https://api.promptfoundry.ai/sdk/v1')
33+
this.client = createApiClient(baseUrl)
3234
}
3335

3436
public async getRawPrompt({ id }: { id: string }): Promise<PromptConfiguration> {

0 commit comments

Comments
 (0)