藉由免費Groq API服務,橋接使用臉書Meta開放源碼LLM大語言模型,查詢日文相關運用
💜步驟一:
☺💟https://console.groq.com/keys 取得API KEY
☺💟在自己的電腦環境變數,加入GROQ_API_KEY變數,指定您所取得API KEY值
💜步驟二: 備妥PYTHON執行環境
pip install groq
💜步驟三:將下面藍色部分,另存成 PYTHON程式碼(如:testgroq.py ),並且執行它即可
import os
from groq import Groq
client = Groq(
api_key=os.environ.get("GROQ_API_KEY"),
)
chat_completion = client.chat.completions.create(
messages=[
{
"role": "user",
"content":
"あなたは日本語のプロで、勉強法の達人です。 {{関連表現}}の語源は教えて、漢字ははっきりとはしないが、省略しても構いません。 {{関連表現}}の文法解説・例文と類義語を簡潔な概要でまとめてください。もし、その表現はニュアンス、意志、自発、あるいは自分、他の人、その他の表現などに関連があれば、使い方を教えて暗記しやすいように、その他の類義表現文型と違いところを表形式に挙げてください。それぞれの表現に焦点を当てたYOUTUBE動画を挙げてください 関連表現: かたがた、を兼ねて、ついで、がてら、かたわら ",
}
],
model="Llama3-70b-8192",
)
print(chat_completion.choices[0].message.content)
相關資訊:
Japanese relationship learning日文相關連關鍵資訊查詢,增進廣度面向之學習。
💛後記:測試結果,取得YOUTUBE連結不能使用,可能持續MachineLearning學習中?
💛Temperature Control: (可於程式碼中 ,在model="Llama3-70b-8192"上方,加入 temperature = 0.1 ,不加溫度參數效果較好)A lower temperature results in more deterministic and focused responses, while a higher temperature increases diversity and explores more unconventional possibilities.
💙回傳結果如下:
**1. かたがた (katagata)**
Meaning: and so on, and other things like that
(略)
Example sentence: 私のかたがた、運動ですか? (Watashi no katagata, undō desu ka? - Are you doing exercise and other things like that?)
**2. を兼ねて (o kane te)**
Meaning: while doing, simultaneously
(略)
Example sentence: 私は仕事を兼ねて、ユーチューブを見ています (Watashi wa shigoto o kane te, Yūchūbu o mite imasu - I'm watching YouTube while working)
**3. ついで (tsuide)**
Meaning: by the way, while I'm at it
(略)
Example sentence: 私は店についで、雑貨を買います (Watashi wa mise ni tsuide, zakka o kaimasu - I'll buy some miscellaneous goods while I'm at the store)
**4. がてら (gatera)**
Meaning: and other things, et cetera
(略)
Example sentence: 私は料理がてら、健康について学びます (Watashi wa ryōri gatera, kenkō ni tsuite gakushū shimasu - I'll learn about cooking and other things, like health)
**5. かたわら (katawara)**
- This word means "on the side" or "in addition to."
* Example: 「私は本業のかたわら、フリーランスの仕事もしています」(In addition to my main job, I also do freelance work on the side.)
(略)
參考資訊:
https://console.groq.com/docs/quickstart