From 3ef34e52e2fd5589c7ceb0f013f1b06f5ff6692c Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Thu, 17 Oct 2024 14:48:26 +0900 Subject: [PATCH] create groq --- groq/README.md | 3 +++ groq/main.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 groq/README.md create mode 100644 groq/main.py diff --git a/groq/README.md b/groq/README.md new file mode 100644 index 0000000..31d690d --- /dev/null +++ b/groq/README.md @@ -0,0 +1,3 @@ +``` +$ uv run main.py +``` diff --git a/groq/main.py b/groq/main.py new file mode 100644 index 0000000..382835d --- /dev/null +++ b/groq/main.py @@ -0,0 +1,30 @@ +# /// script +# requires-python = ">=3.12" +# dependencies = [ +# "groq", +# ] +# /// +from groq import Groq + +IMAGE_DATA_URL = "..." + +client = Groq() +completion = client.chat.completions.create( + model="llama-3.2-90b-vision-preview", + messages=[ + { + "role": "user", + "content": [ + {"type": "text", "text": "これは何?"}, + {"type": "image_url", "image_url": {"url": IMAGE_DATA_URL}}, + ], + } + ], + temperature=1, + max_tokens=1024, + top_p=1, + stream=False, + stop=None, +) + +print(completion.choices[0].message)