Skip to content

Commit

Permalink
Adds prompt run url, returns temperature (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfarrell76 authored Nov 6, 2023
1 parent c64f18d commit 4335abb
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Transcend Inc.",
"name": "@transcend-io/cli",
"description": "Small package containing useful typescript utilities.",
"version": "4.114.2",
"version": "4.115.0",
"homepage": "https://github.com/transcend-io/cli",
"repository": {
"type": "git",
Expand Down
17 changes: 14 additions & 3 deletions src/ai/TranscendPromptManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,14 @@ export class TranscendPromptManager<
async reportAndParsePromptRun<TPromptName extends TPromptNames>(
promptName: TPromptName,
{ largeLanguageModel, ...options }: ReportPromptRunOptions,
): Promise<t.TypeOf<TPrompts[TPromptName]['outputCodec']>> {
): Promise<{
/** The ID of the prompt run created on Transcend */
promptRunId: string;
/** The URL of the prompt run on Transcend */
promptRunUrl: string;
/** Resulting prompt run */
result: t.TypeOf<TPrompts[TPromptName]['outputCodec']>;
}> {
const name =
options.name ||
`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;
Expand Down Expand Up @@ -508,7 +515,7 @@ export class TranscendPromptManager<
}

// report successful run
await reportPromptRun(this.graphQLClient, {
const promptRunId = await reportPromptRun(this.graphQLClient, {
productArea: PromptRunProductArea.PromptManager,
...options,
name,
Expand All @@ -521,7 +528,11 @@ export class TranscendPromptManager<
})),
});

return parsed;
return {
result: parsed,
promptRunId,
promptRunUrl: `https://app.transcend.io/prompts/runs/${promptRunId}`,
};
}

/**
Expand Down
6 changes: 6 additions & 0 deletions src/graphql/fetchPrompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ export interface Prompt {
status: AssessmentStatus;
/** The content of the prompt */
content: string;
/** Temperature to use with prompt */
temperature: number;
/** Top P to use with prompt */
topP: number;
/** Max tokens to sample for prompt */
maxTokensToSample: number;
}

const PAGE_SIZE = 20;
Expand Down
6 changes: 6 additions & 0 deletions src/graphql/gqls/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export const PROMPTS = gql`
title
status
content
temperature
topP
maxTokensToSample
}
}
}
Expand Down Expand Up @@ -91,6 +94,9 @@ export const PROMPTS_WITH_VARIABLES = gql`
title
content
status
temperature
topP
maxTokensToSample
}
promptPartials {
id
Expand Down

0 comments on commit 4335abb

Please sign in to comment.