Skip to content

feat(prompt): add url to getPrompt #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2033,6 +2033,7 @@ export class API {
variables
variablesDefaultValues
version
url
lineage {
name
}
Expand Down Expand Up @@ -2064,6 +2065,7 @@ export class API {
variables
variablesDefaultValues
version
url
lineage {
name
}
Expand Down
1 change: 1 addition & 0 deletions src/prompt-engineering/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class PromptFields extends Utils {
createdAt!: string;
name!: string;
version!: number;
url?: Maybe<string>;
versionDesc?: Maybe<string>;
metadata!: Record<string, any>;
items!: Array<OmitUtils<DatasetItem>>;
Expand Down
9 changes: 9 additions & 0 deletions tests/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,15 @@ describe('End to end tests for the SDK', function () {
expect(fetchedPrompt?.version).toBe(0);
});

it('should get the URL for the prompt', async () => {
const prompt = await client.api.getPrompt('Default', 0);
const projectId = await client.api.getProjectId();

expect(prompt?.url).toContain(
`projects/${projectId}/playground?name=Default&version=0`
);
});

it('should format a prompt with default values', async () => {
const prompt = await client.api.getPrompt('Default');

Expand Down
Loading