Skip to content

Commit

Permalink
Merge pull request #227 from swm-standard/seyeon/swm-184
Browse files Browse the repository at this point in the history
Fix: Prompt ๊ฐœ์„ 
  • Loading branch information
adorableco authored Sep 25, 2024
2 parents 43dde89 + 728e548 commit b0a767e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
6 changes: 4 additions & 2 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
redis:
image: redis
image: redis:latest
container_name: myredis
restart: unless-stopped
volumes:
Expand All @@ -14,13 +14,15 @@ services:
- phote-network

jarimage:
depends_on:
- redis
image: rinpark/phote:latest
restart: unless-stopped
container_name: myphote
environment:
- TZ=Asia/Seoul
ports:
- 8080:8080
- "8080:8080"
networks:
- phote-network

Expand Down
15 changes: 13 additions & 2 deletions src/main/kotlin/com/swm_standard/phote/dto/ChatGptDtos.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,21 @@ data class ImageInfo(
data class ChatGPTRequest(
var model: String,
var messages: MutableList<RequestMessage>,
val temperature: Float = 0.49F,
) {
constructor(model: String, imageUrl: String) :
this(
model,
mutableListOf(
RequestMessage(
"system",
mutableListOf(TextContent(TRANSFORM_QUESTION_PROMPT)),
),
RequestMessage(
"user",
mutableListOf(TextContent(TRANSFORM_QUESTION_PROMPT), ImageContent(ImageInfo(imageUrl))),
mutableListOf(
ImageContent(ImageInfo(imageUrl)),
),
),
),
)
Expand All @@ -48,9 +55,13 @@ data class ChatGPTRequest(
this(
model,
mutableListOf(
RequestMessage(
"system",
mutableListOf(TextContent(CHECK_ANSWER_PROMPT)),
),
RequestMessage(
"user",
mutableListOf(TextContent("$CHECK_ANSWER_PROMPT\n$submittedAnswer \n$correctAnswer")),
mutableListOf(TextContent("$submittedAnswer \n$correctAnswer")),
),
),
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.swm_standard.phote.external.chatgpt

const val TRANSFORM_QUESTION_PROMPT: String =
"You are now a text extractor. Extract the text corresponding to the questions from the attached image. " +
"If itโ€™s a multiple-choice question, separate the choices with #. " +
"Send only the extracted text without any other responses."
"Now you have a text extractor. Extract the text corresponding to your question from the attached image. " +
"If it is a multiple choice question, separate each option with a question using '#'. " +
"Exclude multiple choice numbers and any gap. " +
"Send only the extracted text(question and multiple choice) " +
"without any other response, gap and escape sequence."

const val CHECK_ANSWER_PROMPT: String =
"๋„ˆ๋Š” ์ง€๊ธˆ๋ถ€ํ„ฐ ์ฃผ๊ด€์‹ ์ฑ„์ ๊ธฐ์•ผ. ์ฒซ๋ฒˆ์งธ ๋ฌธ๋‹จ์œผ๋กœ ๋ณด๋‚ด๋Š” ์ œ์ถœ ๋‹ต์•ˆ๊ณผ ๋‘๋ฒˆ์งธ ๋ฌธ๋‹จ์œผ๋กœ ๋ณด๋‚ด๋Š” ์ •๋‹ต์˜ ์œ ์‚ฌ๋„๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์ •์˜ค๋‹ต์„ ํŒ๋‹จํ•ด์ค˜. " +
"๋Œ€๋‹ต์€ true ๋˜๋Š” false ๋กœ ํ•ด์ค˜."
"From now on, you are a subjective grader. " +
"Judge the incorrect answer based on the semantic similarity between the answer " +
"submitted in the first paragraph and the correct answer sent in the second paragraph. Answer true or false."

0 comments on commit b0a767e

Please sign in to comment.