hf-hub-session-captures
收藏资源简介:
该数据集名为dacorvo/hf-hub-session-captures,是一个记录代理(agent)与模型(model)之间交互过程的HTTP捕获数据集。每条数据记录(对应数据表的一行)代表一次对/v1/chat/completions API端点的调用,数据由HuggingFace的开源工具agentcap生成。该数据集是hf-hub-session集合的一部分,与名为hf-hub-session-<agent>-traces的原始会话追踪数据集是配套关系,两者可以通过共享的`run_id`字段进行关联和联合分析。数据集包含11个字段,详细记录了每次交互的元数据和内容。核心字段包括:`run_id`(用于关联追踪数据集的代理运行标识符)、`request_id`(由捕获代理生成的唯一请求ID)、`model`(请求中指定的模型标识符)、`captured_at`(请求被捕获的时间戳,单位为纪元秒)。最关键的内容字段是`request`和`response`,它们分别以JSON字符串的形式存储了原始的OpenAI格式请求体和响应体。对于流式响应(Server-Sent Events),`response`字段有特定的结构(`{"stream": true, "raw": ...}`)。此外,数据集还包含了与HuggingFace路由服务相关的头部信息字段:`served_by`(X-Served-By响应头,指示路由的子提供商)、`served_build_info`(X-Build-Info响应头)、`served_model`(响应体回显的模型标识)。最后,`provider`和`upstream_url`字段分别记录了捕获时代理上游的提供商标识和具体URL。使用该数据集时,需要将`request`和`response`字段进行JSON解析。如需恢复请求中每条消息对应的token范围,需要用户自行使用相应模型的tokenizer(如`transformers.AutoTokenizer.apply_chat_template`)对请求消息进行渲染。该数据集适用于分析代理-模型的交互模式、研究API调用行为、进行模型响应质量评估或路由策略分析等任务。
The dataset named dacorvo/hf-hub-session-captures is an HTTP capture dataset that records the interaction process between agents and models. Each data record (corresponding to a row in the data table) represents a call to the /v1/chat/completions API endpoint, and the data is generated by HuggingFaces open-source tool agentcap. This dataset is part of the hf-hub-session collection and is complementary to the original session trace dataset named hf-hub-session-<agent>-traces, with both being linkable via the shared `run_id` field for joint analysis. The dataset contains 11 fields that detail the metadata and content of each interaction. Core fields include: `run_id` (agent run identifier for linking with trace datasets), `request_id` (unique request ID generated by the capture agent), `model` (model identifier specified in the request), `captured_at` (timestamp when the request was captured, in epoch seconds). The most critical content fields are `request` and `response`, which store the original OpenAI format request body and response body as JSON strings, respectively. For streaming responses (Server-Sent Events), the `response` field has a specific structure (`{"stream": true, "raw": ...}`). Additionally, the dataset includes header-related fields associated with HuggingFace routing services: `served_by` (X-Served-By response header indicating the sub-provider of the route), `served_build_info` (X-Build-Info response header), `served_model` (model identifier echoed in the response body). Finally, the `provider` and `upstream_url` fields record the provider identifier and specific URL of the agents upstream at the time of capture. When using this dataset, the `request` and `response` fields require JSON parsing. To recover the token ranges corresponding to each message in the request, users need to render the request messages using the appropriate models tokenizer (e.g., `transformers.AutoTokenizer.apply_chat_template`). This dataset is suitable for tasks such as analyzing agent-model interaction patterns, studying API call behaviors, evaluating model response quality, or analyzing routing strategies.
数据集概述
数据集名称:dacorvo/hf-hub-session-captures
许可证:Apache-2.0
数据集标签:agentcap, agentcap-captures
数据集描述:该数据集包含了代理(agent)与模型(model)之间交互的HTTP捕获记录,每一行对应一次 /v1/chat/completions 调用。数据集由 agentcap 工具生成。
配套数据集:相同的运行会话的本地跟踪记录存储在同名的 hf-hub-session-<agent>-traces 数据集中,所有数据集均归属于 hf-hub-session Collection,通过 run_id 字段进行关联。
加载方式
python from datasets import load_dataset
ds = load_dataset("dacorvo/hf-hub-session-captures", split="train")
数据模式(Schema)
| 列名 | 描述 |
|---|---|
run_id |
agentcap 运行ID;与跟踪数据集中每个运行文件夹匹配 |
request_id |
由捕获代理生成的UUID |
model |
捕获请求体中的模型ID |
captured_at |
请求被捕获时的Unix时间戳(秒) |
request |
原始OpenAI请求体,JSON字符串化 |
response |
原始OpenAI响应体,JSON字符串化(对于SSE流式响应,格式为 {"stream": true, "raw": ...}) |
served_by |
每个响应中的 X-Served-By 头部(HF Router子提供商路由) |
served_build_info |
每个响应中的 X-Build-Info 头部 |
served_model |
响应体中回显的 model 字段 |
provider |
从代理上游URL推导得出(每个文件恒定) |
upstream_url |
捕获时的代理上游URL(每个文件恒定) |
数据处理说明
request和response字段为JSON字符串,使用时需通过json.loads()解析。- 若要恢复每条消息的token范围,需自行将
request.messages通过模型的聊天模板进行渲染,可使用transformers.AutoTokenizer.apply_chat_template方法。




