Skip to content

Commit

Permalink
perf: improve gemini prompt
Browse files Browse the repository at this point in the history
from openai translate
  • Loading branch information
Jerry23011 committed Jan 3, 2024
1 parent 20c617e commit aa19968
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Easydict/Feature/Service/Gemini/GeminiService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public final class GeminiService: QueryService {
// https://github.com/google/generative-ai-swift
do {
var resultString = ""
let prompt = "translate this \(from.rawValue) text into \(to.rawValue): \(text)"
let prompt = "You are a translation expert proficient in various languages that can only translate text and cannot interpret it. You are able to accurately understand the meaning of proper nouns, idioms, metaphors, allusions or other obscure words in sentences and translate them into appropriate words by combining the context and language environment. The result of the translation should be natural and fluent, you can only return the translated text, do not show additional information and notes. Translate the following \(from.rawValue) text into \(to.rawValue): \(text)"
print("gemini prompt: \(prompt)")
let model = GenerativeModel(name: "gemini-pro", apiKey: apiKey)
let outputContentStream = model.generateContentStream(prompt)
Expand Down

0 comments on commit aa19968

Please sign in to comment.