### Select MySQL Components for Installation Source: https://www.volcengine.com/docs/6396/1874609 In the custom setup, select 'MySQL Server 8.0.42-X64', 'MySQL Documentation', and 'Samples and Examples' from the product catalog. Ensure documentation and examples match the server version for compatibility. ```bash In the left product directory, select the target version "MySQL Server 8.0.42-X64" and corresponding "MySQL Documentation" and "Samples and Examples". After selection, click "Next" to proceed. ``` -------------------------------- ### Install MySQL Installer - Custom Setup Source: https://www.volcengine.com/docs/6396/1874609 Begin the installation by double-clicking the installer. Choose 'Custom' installation to select specific components. ```bash Double-click the installer "mysql-installer-community". Select "Custom" (custom installation), click "Next" button. ``` -------------------------------- ### Go Quick Start Source: https://www.volcengine.com/docs/82379/2536020?lang=zh Example of how to make your first API call using the Go SDK. ```APIDOC ## Go SDK ### Description This Go code snippet demonstrates how to initialize the Ark client and make a response creation call. ### Method `client.CreateResponses()` ### Parameters - **ctx** (context.Context) - Required - The context for the request. - **request** (*responses.ResponsesRequest) - Required - The request object containing model and input details. - **Model** (string) - Required - The model to use for generation. - **Input** (*responses.ResponsesInput) - Required - The prompt for the model. - **Thinking** (*responses.ResponsesThinking) - Optional - Configuration for deep thinking. ### Request Example ```go package main import ( "context" "fmt" "os" "github.com/volcengine/volcengine-go-sdk/service/arkruntime" "github.com/volcengine/volcengine-go-sdk/service/arkruntime/model/responses" ) func main() { client := arkruntime.NewClientWithApiKey( // Get API Key: https://console.volcengine.com/ark/region:ark+cn-beijing/apikey os.Getenv("ARK_API_KEY"), ankruntime.WithBaseUrl("https://ark.cn-beijing.volces.com/api/v3"), ) ctx := context.Background() resp, err := client.CreateResponses(ctx, &responses.ResponsesRequest{ Model: "doubao-seed-2-1-pro-260628", Input: &responses.ResponsesInput{Union: &responses.ResponsesInput_StringValue{StringValue: "hello"}}, // Replace with your prompt // Thinking: &responses.ResponsesThinking{Type: responses.ThinkingType_disabled.Enum()}, // Manually disable deep thinking }) if err != nil { fmt.Printf("response error: %v\n", err) return } fmt.Println(resp) } ``` ### Response #### Success Response (200) - **resp** (*responses.ResponsesResponse) - The response from the model. ``` -------------------------------- ### Java Quick Start Source: https://www.volcengine.com/docs/82379/2536020?lang=zh Example of how to make your first API call using the Java SDK. ```APIDOC ## Java SDK ### Description This Java code snippet demonstrates how to initialize the ArkService and make a response creation call. ### Method `arkService.createResponse()` ### Parameters - **request** (CreateResponsesRequest) - Required - The request object containing model and input details. - **model** (String) - Required - The model to use for generation. - **input** (ResponsesInput) - Required - The prompt for the model. - **thinking** (ResponsesThinking) - Optional - Configuration for deep thinking. ### Request Example ```java package com.ark.sample; import com.volcengine.ark.runtime.service.ArkService; import com.volcengine.ark.runtime.model.responses.request.*; import com.volcengine.ark.runtime.model.responses.response.ResponseObject; public class demo { public static void main(String[] args) { // Get API Key: https://console.volcengine.com/ark/region:ark+cn-beijing/apikey String apiKey = System.getenv("ARK_API_KEY"); // The base URL for model invocation ArkService arkService = ArkService.builder().apiKey(apiKey).baseUrl("https://ark.cn-beijing.volces.com/api/v3").build(); CreateResponsesRequest request = CreateResponsesRequest.builder() .model("doubao-seed-2-1-pro-260628") .input(ResponsesInput.builder().stringValue("hello").build()) // Replace with your prompt // .thinking(ResponsesThinking.builder().type(ResponsesConstants.THINKING_TYPE_DISABLED).build()) // Manually disable deep thinking .build(); ResponseObject resp = arkService.createResponse(request); System.out.println(resp); arkService.shutdownExecutor(); } } ``` ### Response #### Success Response (200) - **resp** (ResponseObject) - The response from the model. ``` -------------------------------- ### Python Quick Start Source: https://www.volcengine.com/docs/82379/2536020?lang=zh Example of how to make your first API call using the Python SDK. ```APIDOC ## Python SDK ### Description This Python code snippet demonstrates how to initialize the Ark client and make a response creation call. ### Method `client.responses.create()` ### Parameters - **model** (string) - Required - The model to use for generation. - **input** (string) - Required - The prompt for the model. - **thinking** (object) - Optional - Configuration for deep thinking. ### Request Example ```python import os from volcenginesdkarkruntime import Ark client = Ark( base_url='https://ark.cn-beijing.volces.com/api/v3', api_key=os.getenv('ARK_API_KEY'), ) response = client.responses.create( model="doubao-seed-2-1-pro-260628", input="hello", # Replace with your prompt # thinking={"type": "disabled"}, # Manually disable deep thinking ) print(response) ``` ### Response #### Success Response (200) - **response** (object) - The response from the model. ``` -------------------------------- ### Curl Quick Start Source: https://www.volcengine.com/docs/82379/2536020?lang=zh Example of how to make your first API call using Curl. ```APIDOC ## Curl ### Description This Curl command demonstrates how to make a request to the API for creating a response. ### Method `curl` ### Endpoint `https://ark.cn-beijing.volces.com/api/v3/responses` ### Headers - **Authorization**: `Bearer $ARK_API_KEY` - **Content-Type**: `application/json` ### Request Body ```json { "model": "doubao-seed-2-1-pro-260628", "input": "hello" } ``` ### Request Example ```bash curl https://ark.cn-beijing.volces.com/api/v3/responses \ -H "Authorization: Bearer $ARK_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "doubao-seed-2-1-pro-260628", "input": "hello" }' ``` ### Response #### Success Response (200) - **response** (object) - The response from the model. ``` -------------------------------- ### Install Volcengine Go SDK Source: https://www.volcengine.com/docs/84313/1254485 Before generating signed requests in Go, install the Volcengine SDK using the go get command. ```Go go get -u github.com/volcengine/volc-sdk-golang Go ``` -------------------------------- ### Go Quick Start Source: https://www.volcengine.com/docs/82379/2535982?lang=zh This snippet provides a Go example for interacting with the Volcano Ark Agent Plan API. ```APIDOC ## Go ### Description This snippet provides a Go example for interacting with the Volcano Ark Agent Plan API. ### Code ```go package main import ( "context" "fmt" "os" "github.com/volcengine/volcengine-go-sdk/service/arkruntime" "github.com/volcengine/volcengine-go-sdk/service/arkruntime/model/responses" ) func main() { client := arkruntime.NewClientWithApiKey( # Get API Key: https://console.volcengine.com/ark/region:ark+cn-beijing/apikey os.Getenv("ARK_API_KEY"), arkruntime.WithBaseUrl("https://ark.cn-beijing.volces.com/api/v3"), ) cxt := context.Background() resp, err := client.CreateResponses(ctx, &responses.ResponsesRequest{ Model: "doubao-seed-2-1-pro-260628", Input: &responses.ResponsesInput{Union: &responses.ResponsesInput_StringValue{StringValue: "hello"}}, // Replace with your prompt // Thinking: &responses.ResponsesThinking{Type: responses.ThinkingType_disabled.Enum()}, // Manually disable deep thinking }) if err != nil { fmt.Printf("response error: %v\n", err) return } fmt.Println(resp) } ``` ``` -------------------------------- ### OpenAI SDK (Python) Quick Start Source: https://www.volcengine.com/docs/82379/2536025?lang=zh Example of how to make your first API call using the OpenAI SDK (Python). ```APIDOC ## OpenAI SDK (Python) Quick Start ### Description This example demonstrates how to initiate your first API call using the OpenAI SDK (Python) to interact with the Volcengine Ark service. ### Method POST ### Endpoint https://ark.cn-beijing.volces.com/api/v3 ### Parameters #### Request Body - **model** (string) - Required - The model to use for the response. - **input** (string) - Required - The prompt to send to the model. ### Request Example ```python import os from openai import OpenAI client = OpenAI( base_url='https://ark.cn-beijing.volces.com/api/v3', ``` -------------------------------- ### Go Quick Start Source: https://www.volcengine.com/docs/82379/2536020?lang=zh Provides a Go example for making an initial API call to the火山方舟 Agent Plan. Ensure the ARK_API_KEY is set in your environment. ```go package main import ( "context" "fmt" "os" "github.com/volcengine/volcengine-go-sdk/service/arkruntime" "github.com/volcengine/volcengine-go-sdk/service/arkruntime/model/responses" ) func main() { client := arkruntime.NewClientWithApiKey( # Get API Key: https://console.volcengine.com/ark/region:ark+cn-beijing/apikey os.Getenv("ARK_API_KEY"), arkruntime.WithBaseUrl("https://ark.cn-beijing.volces.com/api/v3"), ) cxt := context.Background() resp, err := client.CreateResponses(ctx, &responses.ResponsesRequest{ Model: "doubao-seed-2-1-pro-260628", Input: &responses.ResponsesInput{Union: &responses.ResponsesInput_StringValue{StringValue: "hello"}}, // Replace with your prompt # Thinking: &responses.ResponsesThinking{Type: responses.ThinkingType_disabled.Enum()}, // Manually disable deep thinking }) if err != nil { fmt.Printf("response error: %v\n", err) return } fmt.Println(resp) } ``` -------------------------------- ### Create Database and Show Databases Example Source: https://www.volcengine.com/docs/6464/1553683 Demonstrates creating a database and then listing all databases to verify the creation. ```sql -- 1. 创建库 CREATE DATABASE IF NOT EXISTS sample_db ON CLUSTER sample_cluster; -- 2. 查看当前集群中的数据库 SHOW DATABASES; ``` -------------------------------- ### Install Cloud Assistant Response Example Source: https://www.volcengine.com/docs/6396/1133390 Example JSON response after calling the InstallCloudAssistant API, showing instances that have started installation and any failed instances. ```json { "ResponseMetadata": { "RequestId": "202308301A86D*******", "Action": "InstallCloudAssistant", "Version": "2020-04-01", "Service": "ecs", "Region": "cn-beijing" }, "Result": { "InstallingInstanceIds": [ "i-ervasv*****" ], "FailedInstances": [] } } ``` -------------------------------- ### DescribeImageXEdgeRequestRegions API Request Example Source: https://www.volcengine.com/docs/508/1209574 This is an example of a GET request to the DescribeImageXEdgeRequestRegions API, specifying the action, version, start time, and end time. ```http GET https://imagex.volcengineapi.com/?Action=DescribeImageXEdgeRequestRegions&Version=2023-05-01&StartTime=2019-06-02T00:00:00+08:00&EndTime=2019-06-02T00:00:00+08:00 ``` -------------------------------- ### Apply Samples and Examples Configuration Source: https://www.volcengine.com/docs/6396/1874609 Apply the configuration for 'Samples and Examples'. Wait for the configuration to complete successfully, then click 'Finish'. ```bash Click the "Execute" button to apply the configuration. After the application configuration is successful, click the "Finish" button to complete the configuration. ``` -------------------------------- ### ListDomainStatistics API Request Example Source: https://www.volcengine.com/docs/6758/155114?lang=zh This is an example of an HTTP GET request to the ListDomainStatistics API. It includes parameters for action, version, ZID, threshold, start, and end times. ```http GET /?Action=ListDomainStatistics&Version=2018-08-01&ZID=1376&Threshold=100&Start=1639540000&End=1639550000 HTTP/1.1 Host: dns.volcengineapi.com X-Date: 20240908T122410Z Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20240908/cn-beijing/dns/request, SignedHeaders=host;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f ``` -------------------------------- ### Quickstart Example: Table Creation and Data Insertion in Rust Source: https://www.volcengine.com/docs/6517/1493369 Demonstrates dropping an existing database, creating a new one, creating a table, and inserting sample data using the ClickHouse Rust (HTTP) Driver. This example requires the `User` struct to be defined elsewhere. ```Rust pub async fn quickstart_example() -> Result<()> { let client = create_client(); // Drop table if exists and create a new one client .query("DROP DATABASE IF EXISTS bhrusttest") .execute() .await?; client .query("CREATE DATABASE IF NOT EXISTS bhrusttest") .execute() .await?; client .query( "\n CREATE TABLE bhrusttest.users (\n id UInt32,\n name String,\n age UInt8,\n active Bool\n ) ENGINE = CnchMergeTree()\n ORDER BY id\n " ) .execute() .await?; println!("Table created successfully"); // Insert some sample data let mut insert = client.insert("bhrusttest.users")?; let users = vec![ User { id: 1, name: "Alice".to_string(), age: 25, active: true, }, User { id: 2, name: "Bob".to_string(), age: 30, active: true, }, User { id: 3, name: "Charlie".to_string(), age: 35, active: false, }, ]; for User in users { insert.write(&User).await?; } insert.end().await?; println!("Data inserted successfully"); // Select all users let all_users = client .query("SELECT ?fields FROM bhrusttest.users") .with_option("virtual_warehouse", virtual_warehouse_id) .fetch_all::() .await?; println!("\nAll users:"); for User in all_users { println!("{:?}", User); } Ok(()) } ``` -------------------------------- ### Go Quick Start for Volcengine Ark Source: https://www.volcengine.com/docs/82379/2535967?lang=zh Integrate Volcengine Ark into your Go applications with this example. Ensure the ARK_API_KEY environment variable is set. ```go package main import ( "context" "fmt" "os" "github.com/volcengine/volcengine-go-sdk/service/arkruntime" "github.com/volcengine/volcengine-go-sdk/service/arkruntime/model/responses" ) func main() { client := arkruntime.NewClientWithApiKey( // Get API Key: https://console.volcengine.com/ark/region:ark+cn-beijing/apikey os.Getenv("ARK_API_KEY"), arkruntime.WithBaseUrl("https://ark.cn-beijing.volces.com/api/v3"), ) ctx := context.Background() resp, err := client.CreateResponses(ctx, &responses.ResponsesRequest{ Model: "doubao-seed-2-1-pro-260628", Input: &responses.ResponsesInput{Union: &responses.ResponsesInput_StringValue{StringValue: "hello"}}, // Replace with your prompt // Thinking: &responses.ResponsesThinking{Type: responses.ThinkingType_disabled.Enum()}, // Manually disable deep thinking }) if err != nil { fmt.Printf("response error: %v\n", err) return } fmt.Println(resp) } ``` -------------------------------- ### DescribeImageXMultiCompressUsage API Request Example Source: https://www.volcengine.com/docs/508/1209570 This is an example of a GET request to the DescribeImageXMultiCompressUsage API. It includes parameters for action, version, service IDs, start and end times, and interval. ```bash GET https://imagex.volcengineapi.com/?Action=DescribeImageXMultiCompressUsage&Version=2023-05-01&ServiceIds=s1,s2&StartTime=2019-06-02T00:00:00+08:00&EndTime=2019-06-02T00:00:00+08:00&Interval=300 ``` -------------------------------- ### DescribeImageXBaseOpUsage API Request Example Source: https://www.volcengine.com/docs/508/1209562 This is an example of a GET request to the DescribeImageXBaseOpUsage API, including parameters for action, version, service IDs, grouping, start time, end time, and interval. ```http GET https://imagex.volcengineapi.com/?Action=DescribeImageXBaseOpUsage&Version=2023-05-01&ServiceIds=s1,s2&GroupBy=ServiceId&StartTime=2019-06-02T00:00:00+08:00&EndTime=2019-06-02T00:00:00+08:00&Interval=300 ``` -------------------------------- ### Full Initialization and API Call Example (DetailPod) Source: https://www.volcengine.com/docs/6394/1331996 Demonstrates complete initialization of the ACEPService and calling the DetailPod API. It shows how to retrieve credentials from environment variables and set query parameters. ```java package com.volcengine.ACEP.demo; import com.volcengine.model.acep.*; import com.volcengine.service.acep.ACEPService; public class DetailPodDemo { public static void main(String[] args) { // 若通过方式二或者方式三方式设置ak、sk会自动读取,不用直接指定设置ak、sk ACEPService service = ACEPService.getInstance(); // 强烈建议不要把 VOLC_ACCESSKEY 和 VOLC_SECRETKEY 保存到工程代码里,否则可能导致 AccessKey 泄露,威胁您账号下所有资源的安全。 // 本示例通过从环境变量中读取 VOLC_ACCESSKEY 和 VOLC_SECRETKEY,来实现 API 访问的身份验证。运行代码示例前,请配置环境变量 VOLC_ACCESSKEY 和 VOLC_SECRETKEY String ak = System.getenv("VOLC_ACCESSKEY"); String sk = System.getenv("VOLC_SECRETKEY"); //如果需直接指定ak、sk,则通过以下代码设置 service.setAccessKey(ak); service.setSecretKey(sk); DetailPodQuery query = new DetailPodQuery(); // 实例所归属的业务 ID,可在**云手机控制台 > 业务管理 > 业务详情**中获取。 query.setProductId("163571455047xxxx"); // 实例 ID,可通过调用 [ListPod](https://www.volcengine.com/docs/6394/1221468) 接口获取。 query.setPodId("163571455047xxxx"); try { DetailPodRes resp = service.detailPod(query); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } } ``` -------------------------------- ### DescribeVodSpaceEditStatisData API Request Example Source: https://www.volcengine.com/docs/4/1152165?lang=zh This is an example of an HTTP GET request to the Vod API to fetch video editing statistics. It includes parameters for action, version, start time, and end time. ```http https://vod.volcengineapi.com?Action=DescribeVodSpaceEditStatisData&Version=2023-07-01&StartTime=2022-04-18T20:00:00Z&EndTime=2022-04-18T22:00:00Z ``` -------------------------------- ### Configure Samples and Examples Source: https://www.volcengine.com/docs/6396/1874609 Proceed to configure the 'Samples and Examples' component. This step involves verifying the connection to the MySQL database. ```bash Click the "Next" button to configure Samples and Examples. Enter the root account password configured in the previous steps and click the "Check" button to verify the MySQL database connection availability. If a checkmark and "Connection successful" are displayed, the installer confirms the root password is correct and the local MySQL service has started normally. Click "Next" to proceed. ``` -------------------------------- ### UnionProduct API Request Example Source: https://www.volcengine.com/docs/6392/82925 Example of a GET request to the UnionProduct API, including necessary headers and parameters. Ensure you have obtained API access permissions and completed product setup in the Volcengine console. ```http GET /?Action=UnionProduct&Version=2021-01-01&Partner=xxx_default_content&AccessToken=AT6zTZuXzffKpxxxerBKVv8mp94LR2ARdNJBp2BT86GrLpa3brqLmscGCUipuJNh2piKTT12&GroupId=7366891164987048482 HTTP/1.1 Host: https://mercury.volcengineapi.com/?Action=UnionProduct&Version=2021-01-01 X-Date: 20240523T093238Z Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20240523/cn-beijing/content/request, SignedHeaders=host;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f ``` -------------------------------- ### Create and Drop Database Example Source: https://www.volcengine.com/docs/6517/1359472 This example demonstrates creating a database and then dropping it using `DROP DATABASE`. ```sql -- 创建数据库 CREATE DATABASE example_db -- 删除数据库 DROP DATABASE example_db ``` -------------------------------- ### Go SDK Example for CheckLLMPrompt Source: https://www.volcengine.com/docs/84990/1520730?lang=zh This snippet demonstrates how to initialize the Volcengine Go SDK and call the CheckLLMPrompt API to check if a given prompt is compliant. Ensure you have installed and initialized the Go SDK before use. Replace placeholder credentials and host with your actual values. ```Go package main import ( "github.com/volcengine/volcengine-go-sdk/service/waf" "github.com/volcengine/volcengine-go-sdk/volcengine" "github.com/volcengine/volcengine-go-sdk/volcengine/credentials" "github.com/volcengine/volcengine-go-sdk/volcengine/session" ) func main() { ak := "YOUR AK" // Access Key,用于身份验证 sk := "YOUR SK" // Secret Key,用于签名 region := "cn-beijing" // 大模型应用防火墙所属地域对应的 ID config := volcengine.NewConfig(). WithRegion(region). WithCredentials(credentials.NewStaticCredentials(ak, sk, "")) sess, err := session.NewSession(config) if err != nil { print(err.Error()) } svc := waf.New(sess) checkLLMPromptInput := &waf.CheckLLMPromptInput{ Content: volcengine.String("我想知道怎么骗取老人钱财"), // 需要检测的内容 ContentType: volcengine.Int32(1), // 内容类型,当前支持1-文本 Host: volcengine.String("fd****.access.omni-shield.volces.com"), // 大模型应用防火墙生成的接入点域名 MsgClass: volcengine.Int32(0), // 场景类型,当前默认为标准类型,填入 0 即可 Region: volcengine.String("cn-beijing"), // 大模型应用防火墙所属地域对应的 ID } // 复制代码运行示例,请自行打印API返回值。 data, err := svc.CheckLLMPrompt(checkLLMPromptInput) if err != nil { // 复制代码运行示例,请自行打印API错误信息。 print(err.Error()) } else { print(data.String()) } } ``` -------------------------------- ### Quick Start API Call Source: https://www.volcengine.com/docs/82379/2536019?lang=zh This section provides code examples for making your first API call to the Volcengine Ark Runtime. It demonstrates how to invoke models using different programming languages. ```APIDOC ## Quick Start API Call This section provides code examples for making your first API call to the Volcengine Ark Runtime. It demonstrates how to invoke models using different programming languages. ### Python Example ```python import os from volcenginesdkarkruntime import Ark client = Ark( base_url='https://ark.cn-beijing.volces.com/api/v3', # Get API Key: https://console.volcengine.com/ark/region:ark+cn-beijing/apikey api_key=os.getenv('ARK_API_KEY'), ) response = client.responses.create( model="doubao-seed-2-1-pro-260628", input="hello", # Replace with your prompt # thinking={"type": "disabled"}, # Manually disable deep thinking ) print(response) ``` ### Curl Example ```bash # Get API Key: https://console.volcengine.com/ark/region:ark+cn-beijing/apikey curl https://ark.cn-beijing.volces.com/api/v3/responses \ -H "Authorization: Bearer $ARK_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "doubao-seed-2-1-pro-260628", "input": "hello" }' ``` ### Go Example ```go package main import ( "context" "fmt" "os" "github.com/volcengine/volcengine-go-sdk/service/arkruntime" "github.com/volcengine/volcengine-go-sdk/service/arkruntime/model/responses" ) func main() { client := arkruntime.NewClientWithApiKey( // Get API Key: https://console.volcengine.com/ark/region:ark+cn-beijing/apikey os.Getenv("ARK_API_KEY"), arkruntime.WithBaseUrl("https://ark.cn-beijing.volces.com/api/v3"), ) ctx := context.Background() resp, err := client.CreateResponses(ctx, &responses.ResponsesRequest{ Model: "doubao-seed-2-1-pro-260628", Input: &responses.ResponsesInput{Union: &responses.ResponsesInput_StringValue{StringValue: "hello"}}, // Replace with your prompt // Thinking: &responses.ResponsesThinking{Type: responses.ThinkingType_disabled.Enum()}, // Manually disable deep thinking }) if err != nil { fmt.Printf("response error: %v\n", err) return } fmt.Println(resp) } ``` ### Java Example ```java package com.ark.sample; import com.volcengine.ark.runtime.service.ArkService; import com.volcengine.ark.runtime.model.responses.request.*; import com.volcengine.ark.runtime.model.responses.response.ResponseObject; public class demo { public static void main(String[] args) { // Get API Key: https://console.volcengine.com/ark/region:ark+cn-beijing/apikey String apiKey = System.getenv("ARK_API_KEY"); // The base URL for model invocation ArkService arkService = ArkService.builder().apiKey(apiKey).baseUrl("https://ark.cn-beijing.volces.com/api/v3").build(); CreateResponsesRequest request = CreateResponsesRequest.builder() .model("doubao-seed-2-1-pro-260628") .input(ResponsesInput.builder().stringValue("hello").build()) // Replace with your prompt // .thinking(ResponsesThinking.builder().type(ResponsesConstants.THINKING_TYPE_DISABLED).build()) // Manually disable deep thinking .build(); ResponseObject resp = arkService.createResponse(request); System.out.println(resp); arkService.shutdownExecutor(); } } ``` ### OpenAI SDK Python Example ```python import os from openai import OpenAI client = OpenAI( base_url='https://ark.cn-beijing.volces.com/api/v3', ``` -------------------------------- ### 存算一体场景下执行 setup 脚本 Source: https://www.volcengine.com/docs/6491/183114?lang=zh 在存算一体场景下,使用 `tpcds-setup.sh` 或 `tpcds-setup-sparksql.sh` 脚本导入数据。脚本支持指定数据格式、数据规模、存储路径和用户密码。 ```bash #tpcds-setup.sh 脚本中的DATABASE是实际写入的数据库。 #参数1:FORMAT为运行脚本生成的表格式,缺省值为parquet,支持orc,parquet和textfile。也可以通过export FORMAT=parquet 的方式设置全局变量指定。 #参数2:$SCALE-数据规模,需要替换。 #参数3:数据存储路径,passwd:导入用户的密码,导入用户时自己配置的。 #后台执行,hivesql导入内表命令 FORMAT=parquet nohup ./tpcds-setup.sh {SCALE} /hivedata {passwd} & #后台执行,sparksql导入内表命令 FORMAT=parquet nohup ./tpcds-setup-sparksql.sh {SCALE} /hivedata {passwd} & ``` -------------------------------- ### DescribeImageXDomainTrafficData API Request Example Source: https://www.volcengine.com/docs/508/179036?lang=zh This is an example of a GET request to the DescribeImageXDomainTrafficData API, specifying various parameters like Service IDs, Domain Names, Billing Region, Group By, Start Time, End Time, and Interval. ```HTTP GET https://imagex.volcengineapi.com/?Action=DescribeImageXDomainTrafficData&Version=2018-08-01&ServiceIds=s1,s2&DomainNames=d1,d2&BillingRegion=CHN,AP1&GroupBy=DomainName&StartTime=2019-06-02T00:00:00+08:00&EndTime=2019-06-02T00:00:00+08:00&Interval=300 ``` -------------------------------- ### Install Gin Framework Source: https://www.volcengine.com/docs/6348/1415216 Use this command to install the Gin web framework, which is required for the Go service example. ```Shell go get github.com/gin-gonic/gin ``` -------------------------------- ### DescribeImageXVideoClipDurationUsage API Request Source: https://www.volcengine.com/docs/508/1209569 This is an example of a GET request to the DescribeImageXVideoClipDurationUsage API. It includes parameters for action, version, service IDs, start time, end time, and interval. ```bash GET https://imagex.volcengineapi.com/?Action=DescribeImageXVideoClipDurationUsage&Version=2023-05-01&ServiceIds=s1,s2&StartTime=2019-06-02T00:00:00+08:00&EndTime=2019-06-02T00:00:00+08:00&Interval=300 ``` -------------------------------- ### DescribeImageXScreenshotUsage API Request Source: https://www.volcengine.com/docs/508/1209564?lang=zh Example GET request to query screenshot usage for veImageX services. Specify Service IDs, start and end times, and interval for data retrieval. ```http GET https://imagex.volcengineapi.com/?Action=DescribeImageXScreenshotUsage&Version=2023-05-01&ServiceIds=s1,s2&StartTime=2019-06-02T00:00:00+08:00&EndTime=2019-06-02T00:00:00+08:00&Interval=300 ``` -------------------------------- ### Show Create Table Example Source: https://www.volcengine.com/docs/6464/1553683 Demonstrates creating a table with specific engine and order by clauses, then using SHOW CREATE TABLE to view its definition. ```sql -- 1. 创建库 CREATE DATABASE IF NOT EXISTS sample_db ON CLUSTER sample_cluster; -- 2. 创建表 DROP TABLE IF EXISTS sample_db.sample_table ON CLUSTER sample_cluster; CREATE TABLE sample_db.sample_table ON CLUSTER sample_cluster ( `order_by_column` String ) ENGINE = `MergeTree` ORDER BY (`order_by_column`) -- 3. 查看建表语句,系统将返回上述建表语句 SHOW CREATE TABLE sample_db.sample_table ``` -------------------------------- ### GET Request Signature Example Source: https://www.volcengine.com/docs/6369/67269 Example of a calculated signature for a GET request. ```text 1eda9e7e6b1728151a8e8791fdaf67cfbd28bd5c80d0fce2eb208746cf483105 ``` -------------------------------- ### Full Example: Creating Tables and Replacing Partition Source: https://www.volcengine.com/docs/6464/1553680 Demonstrates the complete process of creating a database, two tables with identical structures, inserting data into the source table, and then replacing a specific partition in the target table from the source. ```SQL -- 1. 创建库 CREATE DATABASE IF NOT EXISTS sample_db ON CLUSTER sample_cluster; -- 2. 删除现存表 DROP TABLE IF EXISTS sample_db.sample_table ON CLUSTER sample_cluster; DROP TABLE IF EXISTS sample_db.sample_table2 ON CLUSTER sample_cluster; -- 3. 创建表 1 CREATE TABLE IF NOT EXISTS sample_db.sample_table ON CLUSTER sample_cluster ( `order_by_column` String, `partition_column` Date, `browser` String, `hour` Int32, `x` Int32, `p` Int32 ) ENGINE = MergeTree PARTITION BY partition_column ORDER BY (`order_by_column`); -- 4. 插入数据 INSERT INTO sample_db.sample_table VALUES ('order1', '2020-11-21', 'chrome', 8, 10, 2), ('order2', '2020-11-02', 'chrome', 8, 10, 2), ('order3', '2020-10-05', 'firefox', 9, 20, 2); -- 5. 创建表 2 CREATE TABLE IF NOT EXISTS sample_db.sample_table2 ON CLUSTER sample_cluster ( `order_by_column` String, `partition_column` Date, `browser` String, `hour` Int32, `x` Int32, `p` Int32 ) ENGINE = MergeTree PARTITION BY partition_column ORDER BY (`order_by_column`); -- 6. 将源表(sample_db.sample_table)的指定分区数据覆盖到目标表(sample_db.sample_table2)的同名分区 ALTER TABLE sample_db.sample_table2 REPLACE PARTITION '2020-10-05' FROM sample_db.sample_table; ``` -------------------------------- ### GET Request Authorization Header Example Source: https://www.volcengine.com/docs/6369/67269 Example of the Authorization header for a GET request. ```text HMAC-SHA256 Credential=AKLTYWViMTVmZGYzM2E0NDI5Mzk2MDZjNjFmMjc2MjRjMzg/20250329/cn-beijing/billing/request, SignedHeaders=host;x-date, Signature=1eda9e7e6b1728151a8e8791fdaf67cfbd28bd5c80d0fce2eb208746cf483105 ``` -------------------------------- ### Execute Example with Parameter Binding Source: https://www.volcengine.com/docs/6517/1130430 Instantiates and runs an example using provided credentials and a virtual warehouse ID. Catches and outputs any exceptions during execution. ```php $example = new Example($host, $port, $user, $password, $database, $virtual_warehouse_id); $example->runExample(); } catch (Exception $e) { echo "程序执行失败: " . $e->getTraceAsString() . "\n"; exit(1); } ?> ``` -------------------------------- ### GET Request Full Call Example Source: https://www.volcengine.com/docs/6369/67269 Complete example of a GET request including headers and signature. ```http GET https://billing.volcengineapi.com/?Action=QueryBalanceAcct&Version=2022-01-01 HTTP/1.1 Authorization: HMAC-SHA256 Credential=AKLTYWViMTVmZGYzM2E0NDI5Mzk2MDZjNjFmMjc2MjRjMzg/20250329/cn-beijing/billing/request, SignedHeaders=host;x-date, Signature=1eda9e7e6b1728151a8e8791fdaf67cfbd28bd5c80d0fce2eb208746cf483105 Host: billing.volcengineapi.com X-Date: 20250329T180937Z ``` -------------------------------- ### Install MySQL Client Source: https://www.volcengine.com/docs/6491/1182537?lang=zh Steps to download, decompress, and install the MySQL client. This involves copying files, creating users, and initializing the database. ```shell tar -zxvf mysql-xxx.tar.gz ``` ```shell cp mysql-xxx /usr/local/mysql -r ``` ```shell sudo groupadd mysql sudo useradd -r -g mysql mysql ``` ```shell cd /usr/local/mysql ``` ```shell chown -R mysql:mysql ./ ``` ```shell ./bin/mysql_install_db --user=mysql ``` ```shell sudo bin/mysqld --initialize --user=mysql ``` ```shell chown -R root:root ./ ``` ```shell chown -R mysql:mysql data ``` ```shell cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql ``` ```shell sudo service mysql start ``` -------------------------------- ### Set Video Encoder Configuration (Java) Source: https://www.volcengine.com/docs/6348/70122 Configure video encoding parameters like width, height, frame rate, and max bitrate before starting a stream. This example demonstrates the basic setup in Java. ```java private void setVideoEncoderConfig() { VideoEncoderConfig config = new VideoEncoderConfig(); config.width = 480; config.height = 640; config.frameRate = 10; config.maxBitrate = 1000; rtcVideo.setVideoEncoderConfig(config); } ``` -------------------------------- ### SDK Initialization and Usage Example Source: https://www.volcengine.com/docs/56651/784009?lang=zh This section provides examples of how to initialize and use the SDK for various programming languages. It covers initializing the client with AK, SK, and optionally a custom service URL for overseas or private deployments, and then demonstrates a sample API call using the `dataTester` method. ```APIDOC ## SDK Usage Instructions ### Java * **Source Code:** https://github.com/volcengine/datafinder-sdk-openapi-java * **Package:** https://github.com/volcengine/datafinder-sdk-openapi-java/raw/main/release/javasdk.zip * **Initialization Example:** ```java String ak = "{Replace with your AK}"; String sk = "{Replace with your SK}"; // The default URL for the SDK points to the China region SAAS. RangersClient bc = new RangersClient(ak, sk); // For overseas and private deployments, specify the URL. String url = "{Replace with overseas or Tester service domain}"; RangersClient bc = new RangersClient(ak, sk, url); String result = bc.dataTester("/openapi/v1/openapi-test", "GET"); System.out.println(result); ``` ### Python * **Source Code:** https://github.com/volcengine/datafinder-sdk-openapi-py * **Package:** https://github.com/volcengine/datafinder-sdk-openapi-py/raw/main/release/rangersdk-1.2.0.tar.gz Install the SDK after downloading the package using the following command in your shell: ```bash # Python 3.7 or above is required pip install rangersdk-${version}.tar.gz ``` * **Initialization Example:** ```python from rangersdk import RangersClient ak = '{Replace with your AK}' sk = '{Replace with your SK}' bc = RangersClient(ak, sk) # For overseas and private deployments, specify the URL. url = '{Replace with overseas or Tester service domain}' # When passing the parameter, ensure it is written as url=url bc = RangersClient(ak, sk, url=url) re = bc.data_tester("/openapi/v1/openapi-test", method="GET") print(re.json()) ``` ### Golang * **Source Code:** https://github.com/volcengine/datafinder-sdk-openapi-go * **Package:** https://github.com/volcengine/datafinder-sdk-openapi-go/raw/main/release/gosdk.zip * **Initialization Example:** ```go var ( ak = "{Replace with your AK}" sk = "{Replace with your SK}" ) bc := dslcontent.NewRangersClient(ak, sk) // For overseas and private deployments, specify the URL. url = "{Replace with overseas or Tester service domain}" bc := dslcontent.NewRangersClientWithUrl(ak, sk, url) res, _ := bc.DataTester("/openapi/v1/openapi-test", "GET") data, err := ioutil.ReadAll(res.Body) fmt.Println(err, string(data)) ``` ### JS * **Source Code:** https://github.com/volcengine/datafinder-sdk-openapi-js * **Package:** https://github.com/volcengine/datafinder-sdk-openapi-js/raw/main/release/nodejssdk.zip * **Initialization Example:** ```javascript ak = "{Replace with your AK}" sk = "{Replace with your SK}" bc = new RangersClient(ak, sk) // For overseas and private deployments, specify the URL. url = "{Replace with overseas or Tester service domain}" bc = RangersClient(ak, sk, url=url) bc.dataTester("/openapi/v1/openapi-test", {method: "GET"}) .then(res => res.json()) .then(response => { if (200 !== response['code']) { throw " result is not ok, code: " + response['code'] + ", message: " + response['message']; } console.log(response) console.log('success.') }) .catch(error => console.error('error:', error)); ``` ### PHP * **Source Code:** https://github.com/volcengine/datafinder-sdk-openapi-php * **Package:** https://github.com/volcengine/datafinder-sdk-openapi-php/raw/main/release/phpsdk.zip * **Initialization Example:** ```php $ak = "{Replace with your AK}"; $sk = "{Replace with your SK}"; $bc = new RangersClient($ak, $sk); // For overseas and private deployments, specify the URL. $url = '{Replace with overseas or Tester service domain}' $bc = new RangersClient($ak, $sk, $url); echo $bc->dataTester("/openapi/v1/openapi-test", "GET"); ``` ``` -------------------------------- ### Example: Install PDF Parsing Skill Source: https://www.volcengine.com/docs/6492/2278528?lang=zh This is an example of installing the PDF content parsing skill. It demonstrates replacing the placeholder with the specific skill name in the npm installation command. ```bash npx clawhub@latest install byted-las-document-parse --registry=https://skills.volces.com ```