wikikg-trajectories / README.md
AutomatedScientist's picture
Update README.md
0f20ffa verified
---
license: mit
task_categories:
- text-generation
tags:
- knowledge-graph
- tool-calling
- trajectories
size_categories:
- 1M<n<10M
configs:
- config_name: triplets
data_files: triplets_all.jsonl
default: true
- config_name: trajectories_query_relations
data_files: trajectories_query_relations_1m.jsonl
- config_name: trajectories_get_neighbors
data_files: trajectories_get_neighbors_1m.jsonl
- config_name: paths
data_files: paths_1m.jsonl
---
# WikiKG Trajectories
2M tool-calling trajectories + 366k triplets from Wikipedia knowledge graph.
## Configurations
| Config | Records | Size | Description |
|--------|---------|------|-------------|
| `triplets` (default) | 365,923 | 30 MB | Subject-relation-object triplets |
| `trajectories_query_relations` | 1,000,000 | 5.1 GB | Tool-call conversations (query_relations style) |
| `trajectories_get_neighbors` | 1,000,000 | 5.0 GB | Tool-call conversations (get_neighbors style) |
| `paths` | 1,500,000 | 230 MB | Random walk paths through the graph |
## Tool-Calling Styles
Each trajectory is a multi-turn conversation where an LLM calls tools to traverse the knowledge graph:
- **query_relations**: Calls `query_relations(subject, obj, rel_type)` to filter triplets by entity/relation
- **get_neighbors**: Calls `get_neighbors(entity, direction)` for graph exploration
## Example Trajectory
```json
{
"messages": [
{"role": "user", "content": "Starting from Einstein, follow FIELD_OF forward, then STUDIED_BY backward. What's the final entity?"},
{"role": "assistant", "tool_calls": [{"function": {"name": "query_relations", "arguments": "{\"subject\": \"Einstein\", \"rel_type\": \"FIELD_OF\"}"}}]},
{"role": "tool", "content": "[{\"subject\": \"Einstein\", \"relation\": \"FIELD_OF\", \"object\": \"Physics\"}]"},
...
],
"metadata": {
"path_entities": ["Einstein", "Physics", "Feynman"],
"path_relations": ["FIELD_OF", "STUDIED_BY"],
"num_hops": 2
}
}
```
## Example Triplet
```json
{"subject": "GirardDesargues", "relation": "CREATOR_OF", "object": "DesarguesianPlane"}
```
## Source
Generated from [wiki-kg-dataset](https://huggingface.co/datasets/amanrangapur/wiki-kg-dataset) containing 45,416 Wikipedia articles and 180+ relation types.
## Usage
```python
from datasets import load_dataset
# Load default (triplets)
ds = load_dataset("AutomatedScientist/wikikg-trajectories")
# Load specific config
ds = load_dataset("AutomatedScientist/wikikg-trajectories", "trajectories_query_relations")
ds = load_dataset("AutomatedScientist/wikikg-trajectories", "trajectories_get_neighbors")
ds = load_dataset("AutomatedScientist/wikikg-trajectories", "paths")
```