GreptimeTeam / greptimeai

greptime instrument sdk for popular LLM (LangChain, OpenAI, etc.)
Apache License 2.0
11 stars 1 forks source link

feat: patch stream #94

Closed yuanbohan closed 5 months ago

yuanbohan commented 5 months ago

trace:

mysql> select * from traces_preview_v01 \G;
*************************** 1. row ***************************
           trace_id: 08d7b363c6da267305ea69788dc3cae3
            span_id: 7c88ddfd911e535d
     parent_span_id:
resource_attributes: {"telemetry.sdk.language":"python","telemetry.sdk.name":"opentelemetry","telemetry.sdk.version":"1.21.0","service.name":"openai"}
         scope_name: greptimeai
      scope_version: 0.1.11
   scope_attributes: {}
        trace_state:
          span_name: client.chat.completions.create
          span_kind: SPAN_KIND_INTERNAL
   span_status_code: STATUS_CODE_OK
span_status_message:
    span_attributes: {"model":"gpt-3.5-turbo","user_id":"2222","completion_tokens":52,"completion_cost":0.000078}
        span_events: [{"name":"start","time":"2023-12-06 09:04:39.179636+0000","attributes":{"messages":"[{\"role\": \"user\", \"content\": \"give me 10 baby girl names\"}]","model":"gpt-3.5-turbo","user":"2222","stream":true,"otlp_json_keys":["messages"]}},{"name":"stream","time":"2023-12-06 09:04:40.718817+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"\", \"function_call\": null, \"role\": \"assistant\", \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:40.776598+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"1\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:40.778132+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \".\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:40.778827+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \" Ava\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:40.904429+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"\\n\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:40.905690+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"2\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:40.907149+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \".\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.031932+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \" Emma\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.032991+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"\\n\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.034268+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"3\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.150059+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \".\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.150742+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \" Olivia\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.151557+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"\\n\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.280544+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"4\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.281630+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \".\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.282528+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \" Sophia\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.387769+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"\\n\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.388625+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"5\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.389325+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \".\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.494331+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \" Mia\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.495538+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"\\n\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.496910+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"6\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.634179+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \".\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.635257+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \" Is\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.636068+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"abella\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.748727+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"\\n\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.750033+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"7\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.750580+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \".\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.869012+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \" Charlotte\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.870130+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"\\n\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.870767+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"8\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.992064+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \".\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.993481+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \" Amelia\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:41.994718+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"\\n\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:42.107285+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"9\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:42.108422+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \".\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:42.109448+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \" Harper\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:42.190231+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"\\n\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:42.192105+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \"10\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:42.192801+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \".\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:42.193543+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": \" Evelyn\", \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": null, \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"stream","time":"2023-12-06 09:04:42.193882+0000","attributes":{"id":"chatcmpl-8Si7e5WQwKTbxhagkr3Qb8m4oGOVW","choices":"[{\"delta\": {\"content\": null, \"function_call\": null, \"role\": null, \"tool_calls\": null}, \"finish_reason\": \"stop\", \"index\": 0}]","created":1701853482,"model":"gpt-3.5-turbo-0613","object":"chat.completion.chunk","otlp_json_keys":["choices"]}},{"name":"end","time":"2023-12-06 09:04:42.194477+0000","attributes":{}}]
         span_links: []
              start: 2023-12-06 09:04:39.179619
                end: 2023-12-06 09:04:42.194480
     greptime_value: 3014.861
 greptime_timestamp: 2023-12-06 09:04:39.179
1 row in set (0.01 sec)
yuanbohan commented 5 months ago

metrics:

mysql> select * from llm_completion_tokens;
+------------------------+--------------------+-----------------------+--------------+--------------------------------+--------------------+-------------------------+----------------+
| telemetry_sdk_language | telemetry_sdk_name | telemetry_sdk_version | service_name | span_name                      | model              | greptime_timestamp      | greptime_value |
+------------------------+--------------------+-----------------------+--------------+--------------------------------+--------------------+-------------------------+----------------+
| python                 | opentelemetry      | 1.21.0                | openai       | client.chat.completions.create | gpt-3.5-turbo-0613 | 2023-12-06 09:04:51.146 |             52 |
| python                 | opentelemetry      | 1.21.0                | openai       | client.chat.completions.create | gpt-3.5-turbo-0613 | 2023-12-06 09:05:06.189 |             52 |
| python                 | opentelemetry      | 1.21.0                | openai       | client.chat.completions.create | gpt-3.5-turbo-0613 | 2023-12-06 09:05:21.194 |             52 |
| python                 | opentelemetry      | 1.21.0                | openai       | client.chat.completions.create | gpt-3.5-turbo-0613 | 2023-12-06 09:05:36.207 |             52 |
| python                 | opentelemetry      | 1.21.0                | openai       | client.chat.completions.create | gpt-3.5-turbo-0613 | 2023-12-06 09:05:51.219 |             52 |
| python                 | opentelemetry      | 1.21.0                | openai       | client.chat.completions.create | gpt-3.5-turbo-0613 | 2023-12-06 09:06:06.228 |             52 |
+------------------------+--------------------+-----------------------+--------------+--------------------------------+--------------------+-------------------------+----------------+
6 rows in set (0.03 sec)

mysql> select * from llm_completion_tokens_cost;
+------------------------+--------------------+-----------------------+--------------+--------------------+--------------------------------+-------------------------+----------------+
| telemetry_sdk_language | telemetry_sdk_name | telemetry_sdk_version | service_name | model              | span_name                      | greptime_timestamp      | greptime_value |
+------------------------+--------------------+-----------------------+--------------+--------------------+--------------------------------+-------------------------+----------------+
| python                 | opentelemetry      | 1.21.0                | openai       | gpt-3.5-turbo-0613 | client.chat.completions.create | 2023-12-06 09:04:51.146 |       0.000078 |
+------------------------+--------------------+-----------------------+--------------+--------------------+--------------------------------+-------------------------+----------------+
1 row in set (0.01 sec)

mysql> select * from llm_prompt_tokens;
+------------------------+--------------------+-----------------------+--------------+--------------------------------+---------------+-------------------------+----------------+
| telemetry_sdk_language | telemetry_sdk_name | telemetry_sdk_version | service_name | span_name                      | model         | greptime_timestamp      | greptime_value |
+------------------------+--------------------+-----------------------+--------------+--------------------------------+---------------+-------------------------+----------------+
| python                 | opentelemetry      | 1.21.0                | openai       | client.chat.completions.create | gpt-3.5-turbo | 2023-12-06 09:04:51.146 |             20 |
| python                 | opentelemetry      | 1.21.0                | openai       | client.chat.completions.create | gpt-3.5-turbo | 2023-12-06 09:05:06.189 |             20 |
| python                 | opentelemetry      | 1.21.0                | openai       | client.chat.completions.create | gpt-3.5-turbo | 2023-12-06 09:05:21.194 |             20 |
| python                 | opentelemetry      | 1.21.0                | openai       | client.chat.completions.create | gpt-3.5-turbo | 2023-12-06 09:05:36.207 |             20 |
| python                 | opentelemetry      | 1.21.0                | openai       | client.chat.completions.create | gpt-3.5-turbo | 2023-12-06 09:05:51.219 |             20 |
| python                 | opentelemetry      | 1.21.0                | openai       | client.chat.completions.create | gpt-3.5-turbo | 2023-12-06 09:06:06.228 |             20 |
| python                 | opentelemetry      | 1.21.0                | openai       | client.chat.completions.create | gpt-3.5-turbo | 2023-12-06 09:06:21.248 |             20 |
+------------------------+--------------------+-----------------------+--------------+--------------------------------+---------------+-------------------------+----------------+
7 rows in set (0.00 sec)

mysql> select * from llm_prompt_tokens_cost;
+------------------------+--------------------+-----------------------+--------------+---------------+--------------------------------+-------------------------+----------------+
| telemetry_sdk_language | telemetry_sdk_name | telemetry_sdk_version | service_name | model         | span_name                      | greptime_timestamp      | greptime_value |
+------------------------+--------------------+-----------------------+--------------+---------------+--------------------------------+-------------------------+----------------+
| python                 | opentelemetry      | 1.21.0                | openai       | gpt-3.5-turbo | client.chat.completions.create | 2023-12-06 09:04:51.146 |        0.00003 |
+------------------------+--------------------+-----------------------+--------------+---------------+--------------------------------+-------------------------+----------------+
1 row in set (0.00 sec)
yuanbohan commented 5 months ago

show tables

mysql> show tables;
+--------------------------------+
| Tables                         |
+--------------------------------+
| llm_completion_tokens          |
| llm_completion_tokens_cost     |
| llm_prompt_tokens              |
| llm_prompt_tokens_cost         |
| llm_request_duration_ms_bucket |
| llm_request_duration_ms_count  |
| llm_request_duration_ms_sum    |
| numbers                        |
| traces_preview_v01             |
+--------------------------------+
9 rows in set (0.01 sec)