プレイグラウンド、サンドボックス、使い捨てスクリプト置き場
0

Configure Feed

Select the types of activity you want to include in your feed.

create groq

Kohei Watanabe (Oct 17, 2024, 2:48 PM +0900) 3ef34e52 2794034e

+33
+3
groq/README.md
··· 1 + ``` 2 + $ uv run main.py 3 + ```
+30
groq/main.py
··· 1 + # /// script 2 + # requires-python = ">=3.12" 3 + # dependencies = [ 4 + # "groq", 5 + # ] 6 + # /// 7 + from groq import Groq 8 + 9 + IMAGE_DATA_URL = "..." 10 + 11 + client = Groq() 12 + completion = client.chat.completions.create( 13 + model="llama-3.2-90b-vision-preview", 14 + messages=[ 15 + { 16 + "role": "user", 17 + "content": [ 18 + {"type": "text", "text": "これは何?"}, 19 + {"type": "image_url", "image_url": {"url": IMAGE_DATA_URL}}, 20 + ], 21 + } 22 + ], 23 + temperature=1, 24 + max_tokens=1024, 25 + top_p=1, 26 + stream=False, 27 + stop=None, 28 + ) 29 + 30 + print(completion.choices[0].message)