Skip to content

Commit

Permalink
truthをclaudeに
Browse files Browse the repository at this point in the history
  • Loading branch information
eatski committed Mar 23, 2024
1 parent ff86b2d commit 438f0c5
Show file tree
Hide file tree
Showing 45 changed files with 207 additions and 81 deletions.
17 changes: 7 additions & 10 deletions prompts/truth.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
# Instruction

You are the game master of the quiz.
Compare the user's input with the answer and output as is_cover whether the user's input describes what is stated in the answer.

## Output Patterns

If the input covers the elements mentioned in the answer: Covers
If any of the elements mentioned in the answer are not described in the input: Wrong
If the input is wrong: Wrong

# User's Input
{{input}}
Compare the user's input with the following answer and output whether the user's input describes what is stated in the answer.

# Answer
{{answer}}

## Output Patterns
Output with "Correct" or "Incorrect"

If the input covers the elements mentioned in the answer,output "Correct".
If any of the elements mentioned in the answer are not described in the input, output "Incorrect".
If the input is wrong, output "Incorrect"
2 changes: 1 addition & 1 deletion src/components/play/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const AnswerFormContainer: React.FC<{
}
}}
truth={story.truth}
isCorrect={data.result === "Covers"}
isCorrect={data.result === "Correct"}
distance={data.distance}
/>
</>
Expand Down

This file was deleted.

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"value":{"id":"msg_0185K22yrdfCD2hC6mMGpvct","type":"message","role":"assistant","content":[{"type":"text","text":"Incorrect"}],"model":"claude-3-opus-20240229","stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":182,"output_tokens":5}},"type":"Object","created":"2024-03-23T11:56:13.349Z","ttl":0}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"value":{"id":"msg_0192uVHjskoXxnacy2MJZKzT","type":"message","role":"assistant","content":[{"type":"text","text":"Incorrect"}],"model":"claude-3-opus-20240229","stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":184,"output_tokens":5}},"type":"Object","created":"2024-03-23T11:56:06.386Z","ttl":0}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"value":{"id":"msg_014judSchBLBPVVXVnoN9pk1","type":"message","role":"assistant","content":[{"type":"text","text":"Correct"}],"model":"claude-3-opus-20240229","stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":157,"output_tokens":5}},"type":"Object","created":"2024-03-23T11:56:03.134Z","ttl":0}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"value":{"id":"msg_01BFuZy3zHAHWvLR5HtjRAnL","type":"message","role":"assistant","content":[{"type":"text","text":"Correct"}],"model":"claude-3-opus-20240229","stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":171,"output_tokens":5}},"type":"Object","created":"2024-03-23T11:55:53.071Z","ttl":0}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"value":{"id":"msg_01E7JZKkBgTRViDArZhFxbFB","type":"message","role":"assistant","content":[{"type":"text","text":"Incorrect"}],"model":"claude-3-opus-20240229","stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":177,"output_tokens":5}},"type":"Object","created":"2024-03-23T11:56:11.816Z","ttl":0}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"value":{"id":"msg_014ovDCM7p34eEg4aLWMuE1S","type":"message","role":"assistant","content":[{"type":"text","text":"Correct"}],"model":"claude-3-opus-20240229","stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":165,"output_tokens":5}},"type":"Object","created":"2024-03-23T11:55:54.666Z","ttl":0}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"value":{"id":"msg_01K3Zfc959j8a9GaHsUn5CQ8","type":"message","role":"assistant","content":[{"type":"text","text":"Incorrect"}],"model":"claude-3-opus-20240229","stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":169,"output_tokens":5}},"type":"Object","created":"2024-03-23T11:56:17.241Z","ttl":0}

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"value":{"id":"msg_01JCVeo8dL4f8kGaeW1EjLNX","type":"message","role":"assistant","content":[{"type":"text","text":"Incorrect"}],"model":"claude-3-opus-20240229","stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":190,"output_tokens":5}},"type":"Object","created":"2024-03-23T11:56:04.564Z","ttl":0}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"value":{"id":"msg_01DYeTXRirGBqgS5pM3rHUjn","type":"message","role":"assistant","content":[{"type":"text","text":"Incorrect"}],"model":"claude-3-opus-20240229","stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":184,"output_tokens":5}},"type":"Object","created":"2024-03-23T11:56:08.230Z","ttl":0}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"value":{"id":"msg_0116hgZYicYkWJk11FuhNJdc","type":"message","role":"assistant","content":[{"type":"text","text":"Correct"}],"model":"claude-3-opus-20240229","stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":170,"output_tokens":5}},"type":"Object","created":"2024-03-23T11:55:59.636Z","ttl":0}

This file was deleted.

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"value":{"id":"msg_01TbPo5fWk3QGRExoT3Srykn","type":"message","role":"assistant","content":[{"type":"text","text":"Incorrect"}],"model":"claude-3-opus-20240229","stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":212,"output_tokens":5}},"type":"Object","created":"2024-03-23T11:56:19.185Z","ttl":0}

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"value":{"id":"msg_01RUW8r3n1Txp4TxfcBEbGBc","type":"message","role":"assistant","content":[{"type":"text","text":"Correct"}],"model":"claude-3-opus-20240229","stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":166,"output_tokens":5}},"type":"Object","created":"2024-03-23T11:55:56.045Z","ttl":0}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"value":{"id":"msg_0112tiTsgnqcVcv7v3Axnyyn","type":"message","role":"assistant","content":[{"type":"text","text":"Correct"}],"model":"claude-3-opus-20240229","stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":208,"output_tokens":5}},"type":"Object","created":"2024-03-23T11:55:49.627Z","ttl":0}

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"value":{"id":"msg_01VHFATPpjLGtaW87YQfd67h","type":"message","role":"assistant","content":[{"type":"text","text":"Correct"}],"model":"claude-3-opus-20240229","stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":198,"output_tokens":5}},"type":"Object","created":"2024-03-23T11:55:51.334Z","ttl":0}
136 changes: 136 additions & 0 deletions src/server/procedures/truth/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,69 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して正しい解答をするとCorrectが返る。 ['山田さんは男性用トイレにいたが、他の男性に見つかりそうになり女性用トイレに…'] 1`] = `
{
"distance": 0,
"input": "山田さんは男性用トイレにいたが、他の男性に見つかりそうになり女性用トイレに逃げ込んだ。",
"result": "Correct",
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して正しい解答をするとCorrectが返る。 ['山田さんは男性用トイレにいたが、男性から隠れるために女性用トイレに移動した。'] 1`] = `
{
"distance": 0.22,
"input": "山田さんは男性用トイレにいたが、男性から隠れるために女性用トイレに移動した。",
"result": "Correct",
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して正しい解答をするとCorrectが返る。 ['花子さんはバスの運転手だった'] 1`] = `
{
"distance": 0.28,
"input": "花子さんはバスの運転手だった",
"result": "Correct",
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して正しい解答をするとCorrectが返る。 ['花子さんはバスの運転手なので運転席から離れない。'] 1`] = `
{
"distance": 0.31,
"input": "花子さんはバスの運転手なので運転席から離れない。",
"result": "Correct",
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して正しい解答をするとCorrectが返る。 ['花子さんは市営バスの運転手なので、終点の後も乗っている。'] 1`] = `
{
"distance": 0.35,
"input": "花子さんは市営バスの運転手なので、終点の後も乗っている。",
"result": "Correct",
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して正しい解答をするとCorrectが返る。 ['花子さんは市営バスの運転手なので、終点の後も乗っている。'] 2`] = `
{
"distance": 0.35,
"input": "花子さんは市営バスの運転手なので、終点の後も乗っている。",
"result": "Correct",
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して正しい解答をするとCorrectが返る。 ['花子さんは運転手であり、終点についてもずっと運転席に座っている。'] 1`] = `
{
"distance": 0.3,
"input": "花子さんは運転手であり、終点についてもずっと運転席に座っている。",
"result": "Correct",
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して正しい解答をするとCorrectが返る。 ['花子さんは運転手なので、終点の後も乗っていた。'] 1`] = `
{
"distance": 0.36,
"input": "花子さんは運転手なので、終点の後も乗っていた。",
"result": "Correct",
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して正しい解答をするとCoversが返る。 ['山田さんは男性用トイレにいたが、他の男性に見つかりそうになり女性用トイレに…'] 1`] = `
{
"distance": 0,
Expand Down Expand Up @@ -32,6 +96,70 @@ exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して間違えた解答をするとがIncorrect返る ['山田さんは人を殺害し、見つからないように女性トイレに隠れた'] 1`] = `
{
"distance": 0.39,
"input": "山田さんは人を殺害し、見つからないように女性トイレに隠れた",
"result": "Incorrect",
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して間違えた解答をするとがIncorrect返る ['山田さんは人を殺害し、見つからないように女性トイレに隠れた'] 2`] = `
{
"distance": 0.39,
"input": "山田さんは人を殺害し、見つからないように女性トイレに隠れた",
"result": "Incorrect",
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して間違えた解答をするとがIncorrect返る ['山田さんは女性になりたくて女性用トイレに入った'] 1`] = `
{
"distance": 0.32,
"input": "山田さんは女性になりたくて女性用トイレに入った",
"result": "Incorrect",
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して間違えた解答をするとがIncorrect返る ['山田さんは女性用トイレに入った'] 1`] = `
{
"distance": 0.32,
"input": "山田さんは女性用トイレに入った",
"result": "Incorrect",
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して間違えた解答をするとがIncorrect返る ['山田さんは覗きをするために女性用トイレに入った。'] 1`] = `
{
"distance": 0.3,
"input": "山田さんは覗きをするために女性用トイレに入った。",
"result": "Incorrect",
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して間違えた解答をするとがIncorrect返る ['山田さんは隠れるために女性用トイレに入った'] 1`] = `
{
"distance": 0.31,
"input": "山田さんは隠れるために女性用トイレに入った",
"result": "Incorrect",
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して間違えた解答をするとがIncorrect返る ['山田さんは隠れるために女性用トイレに入った'] 2`] = `
{
"distance": 0.31,
"input": "山田さんは隠れるために女性用トイレに入った",
"result": "Incorrect",
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して間違えた解答をするとがIncorrect返る ['花子さんは死んでしまったため、終点でもずっと座っていた。'] 1`] = `
{
"distance": 0.43,
"input": "花子さんは死んでしまったため、終点でもずっと座っていた。",
"result": "Incorrect",
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して間違えた解答をするとがWrong返る ['山田さんは人を殺害し、見つからないように女性トイレに隠れた'] 1`] = `
{
"distance": 0.39,
Expand All @@ -56,6 +184,14 @@ exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して間違えた解答をするとがWrong返る ['山田さんは女性用トイレに入った'] 2`] = `
{
"distance": 0.32,
"input": "山田さんは女性用トイレに入った",
"result": "Wrong",
}
`;

exports[`trpc/truth > 解答した内容に対して、結果が返る > 真相に対して間違えた解答をするとがWrong返る ['山田さんは覗きをするために女性用トイレに入った。'] 1`] = `
{
"distance": 0.3,
Expand Down
7 changes: 2 additions & 5 deletions src/server/procedures/truth/createPrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ const systemPromptPromise = readFile(
resolve(process.cwd(), "prompts", "truth.md"),
);

export const createPrompt = async (
userInput: string,
simpleTruth: string,
): Promise<string> => {
export const createPrompt = async (simpleTruth: string): Promise<string> => {
const markdown = (await systemPromptPromise).toString();
return Mus.render(markdown, { input: userInput, answer: simpleTruth });
return Mus.render(markdown, { answer: simpleTruth });
};
Loading

0 comments on commit 438f0c5

Please sign in to comment.