Skip to content

Commit

Permalink
feat(prompts): Add Anthropic code snippets to prompt details (#6341)
Browse files Browse the repository at this point in the history
* refactor(prompts): Improve code snippet generation with language-specific configs

* feat(prompts): Add Anthropic code snippets

They still need to be validated, and tests need to be added

* Add tests for anthropic snippet generation

* Fix tool choice

* Properly render tool choice in code snippet

* Add openai tests

* comments
  • Loading branch information
cephalization authored Feb 14, 2025
1 parent a876472 commit c60b77d
Show file tree
Hide file tree
Showing 5 changed files with 1,222 additions and 217 deletions.
66 changes: 66 additions & 0 deletions app/src/pages/prompt/__tests__/fixtures.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import type { PromptCodeExportCard__main$data as PromptVersion } from "../__generated__/PromptCodeExportCard__main.graphql";

export type FixturePromptVersion = Omit<PromptVersion, " $fragmentType">;

export const BASE_MOCK_PROMPT_VERSION = {
modelProvider: "OPENAI",
modelName: "gpt-4",
templateType: "CHAT",
templateFormat: "MUSTACHE",
template: {
__typename: "PromptChatTemplate",
messages: [
{
role: "USER",
content: [{ __typename: "TextContentPart", text: { text: "Hello" } }],
},
],
},
invocationParameters: {
temperature: 0.7,
},
tools: [],
responseFormat: null,
} satisfies FixturePromptVersion;

export const OPENAI_TOOL = {
type: "function",
function: {
name: "test",
description: "test function",
parameters: {
type: "object",
properties: {
foo: {
type: "string",
},
},
required: ["foo"],
},
},
};

export const ANTHROPIC_TOOL = {
name: "test",
description: "test function",
input: {
type: "object",
properties: {
foo: { type: "string" },
},
},
};

export const OPENAI_RESPONSE_FORMAT = {
type: "json_schema",
json_schema: {
name: "test_format",
description: "test format",
schema: {
type: "object",
properties: {
format: { type: "string" },
},
},
},
};
Loading

0 comments on commit c60b77d

Please sign in to comment.