File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
volcenginesdkexamples/volcenginesdkarkruntime Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ from volcenginesdkarkruntime import Ark
2+
3+ # Authentication
4+ # 1.If you authorize your endpoint using an API key, you can set your api key to environment variable "ARK_API_KEY"
5+ # or specify api key by Ark(api_key="${YOUR_API_KEY}").
6+ # Note: If you use an API key, this API key will not be refreshed.
7+ # To prevent the API from expiring and failing after some time, choose an API key with no expiration date.
8+
9+ # 2.If you authorize your endpoint with Volcengine Identity and Access Management(IAM),
10+ # set your api key to environment variable "VOLC_ACCESSKEY", "VOLC_SECRETKEY"
11+ # or specify ak&sk by Ark(ak="${YOUR_AK}", sk="${YOUR_SK}").
12+ # To get your ak&sk, please refer to this document(https://www.volcengine.com/docs/6291/65568)
13+ # For more information,please check this document(https://www.volcengine.com/docs/82379/1263279)
14+ client = Ark ()
15+
16+ # Image input:
17+ response = client .chat .completions .create (
18+ model = "${YOUR_ENDPOINT_ID}" ,
19+ messages = [
20+ {
21+ "role" : "user" ,
22+ "content" : [
23+ {"type" : "text" , "text" : "这是哪里?" },
24+ {
25+ "type" : "image_url" ,
26+ "image_url" : {
27+ "url" : "https://ark-project.tos-cn-beijing.ivolces.com/images/view.jpeg"
28+ }
29+ },
30+ ],
31+ }
32+ ]
33+ )
34+
35+ print (response .choices [0 ])
You can’t perform that action at this time.
0 commit comments