Skip to content

Commit 5975565

Browse files
hawkgsdevversion
authored andcommitted
feat: provide system instructions separately via Genkit.generate system opt param
Provide system instructions as a separate prompt via the `system` option parameter of `Genkit.generate` instead of concatenating them to the main executable prompt.
1 parent a41c1b4 commit 5975565

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

runner/codegen/genkit/genkit-runner.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ export class GenkitRunner implements LlmRunner {
6868
): Promise<LocalLlmGenerateFilesResponse> {
6969
const requestOptions: LocalLlmConstrainedOutputGenerateRequestOptions = {
7070
...options,
71-
prompt: options.context.combinedPrompt,
71+
prompt: options.context.executablePrompt,
72+
systemPrompt: options.context.systemInstructions,
7273
schema: z.object({
7374
outputFiles: z.array(
7475
z.object({
@@ -145,6 +146,7 @@ export class GenkitRunner implements LlmRunner {
145146

146147
const response = await this.genkitInstance.generate({
147148
prompt: options.prompt,
149+
system: options.systemPrompt,
148150
model,
149151
output: schema
150152
? {

runner/codegen/llm-runner.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ interface BaseLlmRequestOptions {
9696
export interface LocalLlmGenerateTextRequestOptions extends BaseLlmRequestOptions {
9797
/** Prompt to send. */
9898
prompt: string;
99+
/** System prompt. */
100+
systemPrompt?: string;
99101
}
100102

101103
/** Context needed for an file generation context. */
@@ -123,6 +125,8 @@ export interface LocalLlmConstrainedOutputGenerateRequestOptions<
123125
> extends BaseLlmRequestOptions {
124126
/** Prompt to send. */
125127
prompt: string;
128+
/** System prompt. */
129+
systemPrompt?: string;
126130
/** Schema that the response should conform to. */
127131
schema: T;
128132
}

0 commit comments

Comments
 (0)