Skip to content

feat: add cls sse example#138

Open
ianhu92 wants to merge 1 commit intoTencentCloud:masterfrom
ianhu92:feat/cls-sse-example
Open

feat: add cls sse example#138
ianhu92 wants to merge 1 commit intoTencentCloud:masterfrom
ianhu92:feat/cls-sse-example

Conversation

@ianhu92
Copy link
Copy Markdown

@ianhu92 ianhu92 commented Apr 3, 2026

正常响应:

php examples/cls/v20201016/ChatCompletions.php
Based on your retrieval analysis requirement "status code 200, count log entries", here is the CQL statement:

\```sql
status:200 | SELECT count(*) AS log_count
\```

**Explanation:**
1. The retrieval condition `status:200` filters logs with status code 200.
2. The SQL statement `SELECT count(*) AS log_count` counts the number of matching log entries.
3. The query validation check passed successfully.

**Query Validation Result:** Validation passed
[流式] 完成,开始非流式调用...
[非流式] 回复内容:
Based on your analysis requirements and log topic information, here is the CQL statement:

\```sql
status:200 | SELECT count(*) AS log_count
\```

**Explanation:**
1. **Retrieval condition**: `status:200` - This filters logs where the status field equals 200 (HTTP status code 200)
2. **Analysis part**: `SELECT count(*) AS log_count` - This counts the number of filtered logs and names the result as "log_count"
3. **Validation result**: The query syntax validation passed successfully.

**Notes:**
- The `status` field exists in your log topic index configuration (status:long::1) with statistics enabled
- This query will return the count of all logs with HTTP status code 200 within your specified time range
(base) ianhu@Ian-MacBook-Pro-M4-Pro tencentcloud-sdk-php % 

错误处理:

php examples/cls/v20201016/ChatCompletions.php

[流式] error {"Code":"ResourceNotFound.TopicNotExist","Message":"topic_id \"xxxxxxxx-xxxx\" does not exist."}

[流式] 完成,开始非流式调用...
[TencentCloud\Common\Exception\TencentCloudSDKException] code:ResourceNotFound.TopicNotExist message:topic_id "xxxxxxxx-xxxx" does not exist. requestId:3497f115-7e6b-4c37-ba91-c38026769b06

@ianhu92 ianhu92 force-pushed the feat/cls-sse-example branch from cc9ddf0 to 1828384 Compare April 3, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant