Spaces:
Runtime error
Runtime error
stakelovelace
commited on
Commit
·
3d604a5
1
Parent(s):
8da9de1
commit from tesla
Browse files- OpenAPI.yaml +0 -0
- README.md +1 -1
- app.py +83 -5
- logs/events.out.tfevents.1714300322.172-3-0-7.lightspeed.irvnca.sbcglobal.net.38279.0 +3 -0
- logs/events.out.tfevents.1714302274.172-3-0-7.lightspeed.irvnca.sbcglobal.net.2417.0 +3 -0
- logs/events.out.tfevents.1714302557.172-3-0-7.lightspeed.irvnca.sbcglobal.net.11242.0 +3 -0
- logs/events.out.tfevents.1714304904.172-3-0-7.lightspeed.irvnca.sbcglobal.net.48966.0 +3 -0
- requirements.txt +8 -0
- test.py +7 -0
- train.csv +29 -0
- train2.csv +29 -0
OpenAPI.yaml
ADDED
The diff for this file is too large to render.
See raw diff
|
|
README.md
CHANGED
@@ -10,4 +10,4 @@ pinned: false
|
|
10 |
license: mit
|
11 |
---
|
12 |
|
13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
10 |
license: mit
|
11 |
---
|
12 |
|
13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
@@ -1,7 +1,85 @@
|
|
1 |
-
import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
def
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
import torch
|
3 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TrainingArguments, Trainer
|
4 |
+
import csv
|
5 |
+
import yaml
|
6 |
+
from datasets import Dataset
|
7 |
+
import os
|
8 |
+
os.environ['PYTORCH_MPS_HIGH_WATERMARK_RATIO'] = '0.0'
|
9 |
|
10 |
+
def load_data_and_config(data_path):
|
11 |
+
"""Loads training data from CSV."""
|
12 |
+
data = []
|
13 |
+
with open(data_path, newline='', encoding='utf-8') as csvfile:
|
14 |
+
reader = csv.DictReader(csvfile, delimiter=';') # Ensure delimiter matches your CSV file
|
15 |
+
for row in reader:
|
16 |
+
data.append({'text': row['description']}) # Changed from 'text' to 'description'
|
17 |
+
return data
|
18 |
|
19 |
+
def generate_api_query(model, tokenizer, prompt, desired_output, api_name, base_url):
|
20 |
+
"""Generates an API query using a fine-tuned model."""
|
21 |
+
input_ids = tokenizer.encode(prompt + f" Write an API query to {api_name} to get {desired_output}", return_tensors="pt")
|
22 |
+
output = model.generate(input_ids, max_length=256, temperature=0.7)
|
23 |
+
query = tokenizer.decode(output[0], skip_special_tokens=True)
|
24 |
+
return f"{base_url}/{query}"
|
25 |
+
|
26 |
+
from transformers import TrainingArguments, Trainer
|
27 |
+
|
28 |
+
def train_model(model, tokenizer, data):
|
29 |
+
"""Trains the model using the Hugging Face Trainer API."""
|
30 |
+
# Encode data and prepare labels
|
31 |
+
inputs = [tokenizer(d['text'], max_length=512, truncation=True, padding='max_length', return_tensors="pt") for d in data]
|
32 |
+
dataset = Dataset.from_dict({
|
33 |
+
'input_ids': [x['input_ids'].squeeze() for x in inputs], # remove extra dimensions
|
34 |
+
'labels': [x['input_ids'].squeeze() for x in inputs]
|
35 |
+
})
|
36 |
+
|
37 |
+
training_args = TrainingArguments(
|
38 |
+
output_dir='./results',
|
39 |
+
num_train_epochs=3,
|
40 |
+
per_device_train_batch_size=1,
|
41 |
+
gradient_accumulation_steps=1,
|
42 |
+
warmup_steps=500,
|
43 |
+
weight_decay=0.01,
|
44 |
+
logging_dir='./logs',
|
45 |
+
logging_steps=10,
|
46 |
+
)
|
47 |
+
|
48 |
+
trainer = Trainer(
|
49 |
+
model=model,
|
50 |
+
args=training_args,
|
51 |
+
train_dataset=dataset,
|
52 |
+
tokenizer=tokenizer
|
53 |
+
)
|
54 |
+
|
55 |
+
# The Trainer handles the training loop internally
|
56 |
+
trainer.train()
|
57 |
+
|
58 |
+
# Optionally clear cache if using GPU or MPS
|
59 |
+
if torch.cuda.is_available():
|
60 |
+
torch.cuda.empty_cache()
|
61 |
+
elif torch.has_mps:
|
62 |
+
torch.mps.empty_cache()
|
63 |
+
|
64 |
+
# Perform any remaining steps such as logging, saving, etc.
|
65 |
+
trainer.save_model()
|
66 |
+
|
67 |
+
if __name__ == "__main__":
|
68 |
+
# Load data and configurations
|
69 |
+
data = load_data_and_config("train2.csv")
|
70 |
+
|
71 |
+
# Load tokenizer and model
|
72 |
+
tokenizer = AutoTokenizer.from_pretrained("google/codegemma-7b-it")
|
73 |
+
model = AutoModelForCausalLM.from_pretrained("google/codegemma-7b-it")
|
74 |
+
|
75 |
+
# Train the model on your dataset
|
76 |
+
train_model(model, tokenizer, data)
|
77 |
+
|
78 |
+
# Save the fine-tuned model
|
79 |
+
model.save_pretrained("./fine_tuned_model")
|
80 |
+
tokenizer.save_pretrained("./fine_tuned_model")
|
81 |
+
|
82 |
+
# Example usage
|
83 |
+
prompt = "I need to retrieve the latest block on chain using a python script"
|
84 |
+
api_query = generate_api_query(model, tokenizer, prompt, "latest block on chain", config["api_name"], config["base_url"])
|
85 |
+
print(f"Generated code: {api_query}")
|
logs/events.out.tfevents.1714300322.172-3-0-7.lightspeed.irvnca.sbcglobal.net.38279.0
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ee5779cb5d7f3c89c1e3a45f82fa0bdb9f4c69d8b1cc891b613a9428f81a36f8
|
3 |
+
size 4670
|
logs/events.out.tfevents.1714302274.172-3-0-7.lightspeed.irvnca.sbcglobal.net.2417.0
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:345e496a1f2e413fc2376fc7e3bde794b6272444b6986e64cded7ee8ad0edaf0
|
3 |
+
size 4670
|
logs/events.out.tfevents.1714302557.172-3-0-7.lightspeed.irvnca.sbcglobal.net.11242.0
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d84d02367d88e32b35fd037af7da458f1fe51ef82341b41172d836f9ef18f05b
|
3 |
+
size 4670
|
logs/events.out.tfevents.1714304904.172-3-0-7.lightspeed.irvnca.sbcglobal.net.48966.0
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f37868e5a5f148b7b03a5624296db83ed18c43e4ad69224cb6d835c6a9a86f58
|
3 |
+
size 4670
|
requirements.txt
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
tensorflow>=2.0
|
2 |
+
transformers>=4.0
|
3 |
+
datasets>=1.0
|
4 |
+
accelerate>=0.21.0
|
5 |
+
pyyaml
|
6 |
+
TFTrainer
|
7 |
+
tf-keras
|
8 |
+
torch
|
test.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import tensorflow as tf
|
2 |
+
from transformers import TFAutoModelForCausalLM
|
3 |
+
|
4 |
+
# Optionally, test loading a model to ensure all components are working
|
5 |
+
model = TFAutoModelForCausalLM.from_pretrained("gpt2") # Just an example, use a model appropriate for TFAutoModelForCausalLM
|
6 |
+
print("Model loaded successfully!")
|
7 |
+
|
train.csv
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
endpoint;tags;summary;text;ordering_filters;parameters;parameters_description;parameter_types;parameter_examples;returning_fields;curl_example
|
2 |
+
/tip;Network;Query Chain Tip;Get the tip info about the latest block seen by chain;;;;;;"hash: string; epoch_no: number; abs_slot: number; epoch_slot: number; block_no: number or null; block_time: number;";"curl -X GET ""https://api.koios.rest/api/v1/tip"" -H ""accept: application/json"""
|
3 |
+
/genesis;Network;Get Genesis info;Get the Genesis parameters used to start specific era on chain;;;;;;;"curl -X GET ""https://api.koios.rest/api/v1/genesis"" -H ""accept: application/json"""
|
4 |
+
/totals;Network;Get historical tokenomic stats;Get the circulating utxo, treasury, rewards, supply, and reserves in lovelace for the specified epoch. Returns data for all epochs if the epoch number is not provided.;;_epoch_no;Epoch number (required to get specific epoch data).;_epoch_no: number;_epoch_no: 480;;"curl -X GET ""https://api.koios.rest/api/v1/totals?_epoch_no=320"" -H ""accept: application/json"""
|
5 |
+
/param_updates;Network;Param Update Proposals;Get all parameter update proposals submitted to the chain starting Shelley era;;;;;;;"curl -X GET ""https://api.koios.rest/api/v1/param_updates"" -H ""accept: application/json"""
|
6 |
+
/reserve_withdrawals;Network;Reserve Withdrawals;List of all withdrawals from reserves against stake accounts;;epoch_no, limit;"Filter blocks by epoch. Use ""epoch_no=eq.{value}"" to filter by an exact match.If not specified, the API defaults to ""eq.{epoch_no}"" where {epoch_no} is the latest epoch fetched from the /tip endpoint.; ";"epoch_no: string; limit: number";"_epoch_no: 480; limit: 5";;"curl -X GET ""https://api.koios.rest/api/v1/reserve_withdrawals"" -H ""accept: application/json"""
|
7 |
+
/treasury_withdrawals;Network;Treasury Withdrawals;List of all withdrawals from treasury against stake accounts;;epoch_no, limit;"Filter blocks by epoch. Use ""epoch_no=eq.{value}"" to filter by an exact match. If not specified, the API defaults to ""eq.{epoch_no}"" where {epoch_no} is the latest epoch fetched from the /tip endpoint.;";"epoch_no: string; limit: number";"_epoch_no: 480; limit: 5";;"curl -X GET ""https://api.koios.rest/api/v1/treasury_withdrawals"" -H ""accept: application/json"""
|
8 |
+
/epoch_info;Epoch;Epoch Information;Get the epoch information, all epochs if no epoch specified;;_epoch_no, include_next_epoch;"Epoch number (required to get specific epoch data).; Include details of the next epoch if available.";"_epoch_no: string; include_next_epoch: boolean";"_epoch_no: 480; include_next_epoch: false";;"curl -X GET ""https://api.koios.rest/api/v1/epoch_info?_epoch_no=320&_include_next_epoch=false"" -H ""accept: application/json"""
|
9 |
+
/epoch_params;Epoch;Epoch's Protocol Parameters;Get the protocol parameters for specific epoch, returns information about all epochs if no epoch specified;;_epoch_no;Epoch number (required to get specific epoch data).;_epoch_no: string;_epoch_no: 480;;"curl -X GET ""https://api.koios.rest/api/v1/epoch_params?_epoch_no=320"" -H ""accept: application/json"""
|
10 |
+
/epoch_block_protocols;Epoch;Epoch's Block Protocols;Get the information about block protocol distribution in epoch;;_epoch_no;Epoch number (required to get specific epoch data).;_epoch_no: string;_epoch_no: 480;;"curl -X GET ""https://api.koios.rest/api/v1/epoch_block_protocols?_epoch_no=320"" -H ""accept: application/json"""
|
11 |
+
/blocks;Block;Block List;Get summarised details about all blocks (paginated - latest first);;epoch_no, limit;"Filter blocks by epoch. Use ""epoch_no=eq.{value}"" to filter by an exact match. When epoch_no is not specified, the API defaults to ""eq.{epoch_no}"" where {epoch_no} is the latest epoch fetched from the /tip endpoint.; ";"epoch_no: string; limit: number";"_epoch_no: 480; limit: 5";;"curl -X GET ""https://api.koios.rest/api/v1/blocks"" -H ""accept: application/json"""
|
12 |
+
/block_info;Block;Block Information;Get detailed information about a specific block;;_block_hashes;Hash of the block;_block_hashes: string;"_block_hashes: [""fb9087c9f1408a7bbd7b022fd294ab565fec8dd3a8ef091567482722a1fa4e30"",""60188a8dcb6db0d80628815be2cf626c4d17cb3e826cebfca84adaff93ad492a"",""c6646214a1f377aa461a0163c213fc6b86a559a2d6ebd647d54c4eb00aaab015""]";;"curl -X POST ""https://api.koios.rest/api/v1/block_info"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_block_hashes"":[""fb9087c9f1408a7bbd7b022fd294ab565fec8dd3a8ef091567482722a1fa4e30"",""60188a8dcb6db0d80628815be2cf626c4d17cb3e826cebfca84adaff93ad492a"",""c6646214a1f377aa461a0163c213fc6b86a559a2d6ebd647d54c4eb00aaab015""]}'"
|
13 |
+
/block_txs;Block;Block Transactions;Get a list of all transactions included in provided blocks;;_block_hashes;Hash of the block;_block_hashes: string;"_block_hashes: [""fb9087c9f1408a7bbd7b022fd294ab565fec8dd3a8ef091567482722a1fa4e30"",""60188a8dcb6db0d80628815be2cf626c4d17cb3e826cebfca84adaff93ad492a"",""c6646214a1f377aa461a0163c213fc6b86a559a2d6ebd647d54c4eb00aaab015""]";;"curl -X POST ""https://api.koios.rest/api/v1/block_txs"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_block_hashes"":[""fb9087c9f1408a7bbd7b022fd294ab565fec8dd3a8ef091567482722a1fa4e30"",""60188a8dcb6db0d80628815be2cf626c4d17cb3e826cebfca84adaff93ad492a"",""c6646214a1f377aa461a0163c213fc6b86a559a2d6ebd647d54c4eb00aaab015""]}'"
|
14 |
+
/utxo_info;Transactions;UTxO Info;Get UTxO set for requested UTxO references;;_utxo_refs, _extended;"_utxo_refs: Array of Cardano utxo references in the form “hash#index”; _extended: Controls whether or not certain optional fields supported by a given endpoint are populated as a part of the call";_tx_hashes: string;"_tx_hashes”:[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94""]";;"curl -X POST ""https://api.koios.rest/api/v1/utxo_info"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_utxo_refs"":[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e#0"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94#0""],""_extended"":false}'"
|
15 |
+
/tx_info;Transactions;Transaction Information;Get detailed information about transaction(s);;_tx_hashes;Array of Cardano Transaction hashes;_tx_hashes: string;"_tx_hashes”:[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94""]";;"curl -X POST ""https://api.koios.rest/api/v1/tx_info"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_tx_hashes"":[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94""]}'"
|
16 |
+
/tx_metadata;Transactions;Transaction Metadata;Get metadata information (if any) for given transaction(s);;_tx_hashes;Array of Cardano Transaction hashes;_tx_hashes: string;"_tx_hashes”:[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94""]";;"curl -X POST ""https://api.koios.rest/api/v1/tx_metadata"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_tx_hashes"":[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94""]}'"
|
17 |
+
/tx_metalabels;Transactions;Transaction Metadata Labels;Get a list of all transaction metalabels;;;;;;;"curl -X GET ""https://api.koios.rest/api/v1/tx_metalabels"" -H ""accept: application/json"""
|
18 |
+
/tx_submit;Transactions;Submit Transaction;Submit an already serialized transaction to the network.;;cbor_data;Assuming ${data} is a raw binary serialized transaction on the file-system.;cbor: binary;;;"curl -X POST --header ""Content-Type: application/cbor"" --data-binary @${data} https://api.koios.rest/api/v1/submittx"
|
19 |
+
/tx_status;Transactions;Transaction Status;Get the number of block confirmations for a given transaction hash list;;_tx_hashes;Array of Cardano Transaction hashes;_tx_hashes: string;"_tx_hashes”:[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94""]";;"curl -X POST ""https://api.koios.rest/api/v1/tx_status"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_tx_hashes"":[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94""]}'"
|
20 |
+
/tx_utxos;Transactions;Transaction UTxOs;Get UTxO set (inputs/outputs) of transactions [DEPRECATED - Use /utxo_info instead].;;_tx_hashes;Array of Cardano Transaction hashes;_tx_hashes: string;"_tx_hashes”:[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94""]";;"curl -X POST ""https://api.koios.rest/api/v1/utxo_info"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_utxo_refs"":[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e#0"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94#0""],""_extended"":false}'"
|
21 |
+
/address_info;Address;Address Information;Get address info - balance, associated stake address (if any) and UTxO set for given addresses;;_addresses;A Cardano payment/base address (bech32 encoded);_addresses: string;"_addresses"":[""addr1qy2jt0qpqz2z2z9zx5w4xemekkce7yderz53kjue53lpqv90lkfa9sgrfjuz6uvt4uqtrqhl2kj0a9lnr9ndzutx32gqleeckv"",""addr1q9xvgr4ehvu5k5tmaly7ugpnvekpqvnxj8xy50pa7kyetlnhel389pa4rnq6fmkzwsaynmw0mnldhlmchn2sfd589fgsz9dd0y""]";;"curl -X POST ""https://api.koios.rest/api/v1/address_info"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_addresses"":[""addr1qy2jt0qpqz2z2z9zx5w4xemekkce7yderz53kjue53lpqv90lkfa9sgrfjuz6uvt4uqtrqhl2kj0a9lnr9ndzutx32gqleeckv"",""addr1q9xvgr4ehvu5k5tmaly7ugpnvekpqvnxj8xy50pa7kyetlnhel389pa4rnq6fmkzwsaynmw0mnldhlmchn2sfd589fgsz9dd0y""]}'"
|
22 |
+
/address_assets;Address;Address Assets;Get the list of all the assets (policy, name and quantity) for given addresses;;_addresses;A Cardano payment/base address (bech32 encoded);_addresses: string;"_addresses"":[""addr1qy2jt0qpqz2z2z9zx5w4xemekkce7yderz53kjue53lpqv90lkfa9sgrfjuz6uvt4uqtrqhl2kj0a9lnr9ndzutx32gqleeckv"",""addr1q9xvgr4ehvu5k5tmaly7ugpnvekpqvnxj8xy50pa7kyetlnhel389pa4rnq6fmkzwsaynmw0mnldhlmchn2sfd589fgsz9dd0y""]";;"curl -X POST ""https://api.koios.rest/api/v1/address_assets"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_addresses"":[""addr1qy2jt0qpqz2z2z9zx5w4xemekkce7yderz53kjue53lpqv90lkfa9sgrfjuz6uvt4uqtrqhl2kj0a9lnr9ndzutx32gqleeckv"",""addr1q9xvgr4ehvu5k5tmaly7ugpnvekpqvnxj8xy50pa7kyetlnhel389pa4rnq6fmkzwsaynmw0mnldhlmchn2sfd589fgsz9dd0y""]}'"
|
23 |
+
/account_list;Stake Account;Account List;Get a list of all stake addresses that have atleast 1 transaction;;;;;;;"curl -X GET ""https://api.koios.rest/api/v1/account_list"" -H ""accept: application/json"""
|
24 |
+
/account_info;Stake Account;Account Information;Get the account information for given stake addresses;;_stake_address;Cardano staking address (reward account) in bech32 format for which the transactions are requested.;_stake_address: string;"_stake_addresses"":[""stake1uyrx65wjqjgeeksd8hptmcgl5jfyrqkfq0xe8xlp367kphsckq250"",""stake1uxpdrerp9wrxunfh6ukyv5267j70fzxgw0fr3z8zeac5vyqhf9jhy""]";;"curl -X POST ""https://api.koios.rest/api/v1/account_info"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_stake_addresses"":[""stake1uyrx65wjqjgeeksd8hptmcgl5jfyrqkfq0xe8xlp367kphsckq250"",""stake1uxpdrerp9wrxunfh6ukyv5267j70fzxgw0fr3z8zeac5vyqhf9jhy""]}'"
|
25 |
+
/account_txs;Stake Account;Account Txs;Get a list of all Txs for a given stake address (account);;_stake_address, _after_block_height;"Cardano staking address (reward account) in bech32 format for which the transactions are requested.; Block height for specifying time delta";"_stake_address: string; _after_block_height: number";"_stake_address: stake1u8yxtugdv63wxafy9d00nuz6hjyyp4qnggvc9a3vxh8yl0ckml2uz; _after_block_height: 100000";;"curl -X GET ""https://api.koios.rest/api/v1/account_txs?_stake_address=stake1u8yxtugdv63wxafy9d00nuz6hjyyp4qnggvc9a3vxh8yl0ckml2uz&_after_block_height=50000"" -H ""accept: application/json"""
|
26 |
+
/account_rewards;Stake Account;Account Rewards;Get the full rewards history (including MIR) for given stake addresses;;_stake_addresses, _epoch_no;"_stake_addresses: Array of Cardano stake address(es) in bech32 format; _epoch_no: Epoch number (required to get specific epoch data).";"_stake_address: string; _epoch_no: number";"_stake_address: stake1u8yxtugdv63wxafy9d00nuz6hjyyp4qnggvc9a3vxh8yl0ckml2uz; _epoch_no: 320";;"curl -X POST ""https://api.koios.rest/api/v1/account_rewards"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_stake_addresses"":[""stake1uyrx65wjqjgeeksd8hptmcgl5jfyrqkfq0xe8xlp367kphsckq250"",""stake1uxpdrerp9wrxunfh6ukyv5267j70fzxgw0fr3z8zeac5vyqhf9jhy""],""_epoch_no"":409}'"
|
27 |
+
/account_updates;Stake Account;Account Updates;Get the account updates (registration, deregistration, delegation and withdrawals) for given stake addresses;;_stake_address;Cardano staking address (reward account) in bech32 format for which the transactions are requested.;_stake_address: string;_stake_address: stake1u8yxtugdv63wxafy9d00nuz6hjyyp4qnggvc9a3vxh8yl0ckml2uz;;"curl -X POST ""https://api.koios.rest/api/v1/account_updates"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_stake_addresses"":[""stake1uyrx65wjqjgeeksd8hptmcgl5jfyrqkfq0xe8xlp367kphsckq250"",""stake1uxpdrerp9wrxunfh6ukyv5267j70fzxgw0fr3z8zeac5vyqhf9jhy""]}'"
|
28 |
+
/account_assets;Stake Account;Account Assets;Get the native asset balance for a given stake address;;_stake_address;Cardano staking address (reward account) in bech32 format for which the transactions are requested.;_stake_address: string;_stake_address: stake1u8yxtugdv63wxafy9d00nuz6hjyyp4qnggvc9a3vxh8yl0ckml2uz;;"curl -X POST ""https://api.koios.rest/api/v1/account_assets"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_stake_addresses"":[""stake1uyrx65wjqjgeeksd8hptmcgl5jfyrqkfq0xe8xlp367kphsckq250"",""stake1uxpdrerp9wrxunfh6ukyv5267j70fzxgw0fr3z8zeac5vyqhf9jhy""]}'"
|
29 |
+
/asset_list;Asset;Asset List;Get the list of all native assets (paginated);;;;;;;"curl -X GET ""https://api.koios.rest/api/v1/asset_list"" -H ""accept: application/json"""
|
train2.csv
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
endpoint;tags;summary;description;ordering_filters;parameters;parameters_description;parameter_types;parameter_examples;returning_fields;curl_example
|
2 |
+
/tip;Network;Query Chain Tip;Get the tip info about the latest block seen by chain;;;;;;"hash: string; epoch_no: number; abs_slot: number; epoch_slot: number; block_no: number or null; block_time: number;";"curl -X GET ""https://api.koios.rest/api/v1/tip"" -H ""accept: application/json"""
|
3 |
+
/genesis;Network;Get Genesis info;Get the Genesis parameters used to start specific era on chain;;;;;;;"curl -X GET ""https://api.koios.rest/api/v1/genesis"" -H ""accept: application/json"""
|
4 |
+
/totals;Network;Get historical tokenomic stats;Get the circulating utxo, treasury, rewards, supply, and reserves in lovelace for the specified epoch. Returns data for all epochs if the epoch number is not provided.;;_epoch_no;Epoch number (required to get specific epoch data).;_epoch_no: number;_epoch_no: 480;;"curl -X GET ""https://api.koios.rest/api/v1/totals?_epoch_no=320"" -H ""accept: application/json"""
|
5 |
+
/param_updates;Network;Param Update Proposals;Get all parameter update proposals submitted to the chain starting Shelley era;;;;;;;"curl -X GET ""https://api.koios.rest/api/v1/param_updates"" -H ""accept: application/json"""
|
6 |
+
/reserve_withdrawals;Network;Reserve Withdrawals;List of all withdrawals from reserves against stake accounts;;epoch_no, limit;"Filter blocks by epoch. Use ""epoch_no=eq.{value}"" to filter by an exact match.If not specified, the API defaults to ""eq.{epoch_no}"" where {epoch_no} is the latest epoch fetched from the /tip endpoint.; ";"epoch_no: string; limit: number";"_epoch_no: 480; limit: 5";;"curl -X GET ""https://api.koios.rest/api/v1/reserve_withdrawals"" -H ""accept: application/json"""
|
7 |
+
/treasury_withdrawals;Network;Treasury Withdrawals;List of all withdrawals from treasury against stake accounts;;epoch_no, limit;"Filter blocks by epoch. Use ""epoch_no=eq.{value}"" to filter by an exact match. If not specified, the API defaults to ""eq.{epoch_no}"" where {epoch_no} is the latest epoch fetched from the /tip endpoint.;";"epoch_no: string; limit: number";"_epoch_no: 480; limit: 5";;"curl -X GET ""https://api.koios.rest/api/v1/treasury_withdrawals"" -H ""accept: application/json"""
|
8 |
+
/epoch_info;Epoch;Epoch Information;Get the epoch information, all epochs if no epoch specified;;_epoch_no, include_next_epoch;"Epoch number (required to get specific epoch data).; Include details of the next epoch if available.";"_epoch_no: string; include_next_epoch: boolean";"_epoch_no: 480; include_next_epoch: false";;"curl -X GET ""https://api.koios.rest/api/v1/epoch_info?_epoch_no=320&_include_next_epoch=false"" -H ""accept: application/json"""
|
9 |
+
/epoch_params;Epoch;Epoch's Protocol Parameters;Get the protocol parameters for specific epoch, returns information about all epochs if no epoch specified;;_epoch_no;Epoch number (required to get specific epoch data).;_epoch_no: string;_epoch_no: 480;;"curl -X GET ""https://api.koios.rest/api/v1/epoch_params?_epoch_no=320"" -H ""accept: application/json"""
|
10 |
+
/epoch_block_protocols;Epoch;Epoch's Block Protocols;Get the information about block protocol distribution in epoch;;_epoch_no;Epoch number (required to get specific epoch data).;_epoch_no: string;_epoch_no: 480;;"curl -X GET ""https://api.koios.rest/api/v1/epoch_block_protocols?_epoch_no=320"" -H ""accept: application/json"""
|
11 |
+
/blocks;Block;Block List;Get summarised details about all blocks (paginated - latest first);;epoch_no, limit;"Filter blocks by epoch. Use ""epoch_no=eq.{value}"" to filter by an exact match. When epoch_no is not specified, the API defaults to ""eq.{epoch_no}"" where {epoch_no} is the latest epoch fetched from the /tip endpoint.; ";"epoch_no: string; limit: number";"_epoch_no: 480; limit: 5";;"curl -X GET ""https://api.koios.rest/api/v1/blocks"" -H ""accept: application/json"""
|
12 |
+
/block_info;Block;Block Information;Get detailed information about a specific block;;_block_hashes;Hash of the block;_block_hashes: string;"_block_hashes: [""fb9087c9f1408a7bbd7b022fd294ab565fec8dd3a8ef091567482722a1fa4e30"",""60188a8dcb6db0d80628815be2cf626c4d17cb3e826cebfca84adaff93ad492a"",""c6646214a1f377aa461a0163c213fc6b86a559a2d6ebd647d54c4eb00aaab015""]";;"curl -X POST ""https://api.koios.rest/api/v1/block_info"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_block_hashes"":[""fb9087c9f1408a7bbd7b022fd294ab565fec8dd3a8ef091567482722a1fa4e30"",""60188a8dcb6db0d80628815be2cf626c4d17cb3e826cebfca84adaff93ad492a"",""c6646214a1f377aa461a0163c213fc6b86a559a2d6ebd647d54c4eb00aaab015""]}'"
|
13 |
+
/block_txs;Block;Block Transactions;Get a list of all transactions included in provided blocks;;_block_hashes;Hash of the block;_block_hashes: string;"_block_hashes: [""fb9087c9f1408a7bbd7b022fd294ab565fec8dd3a8ef091567482722a1fa4e30"",""60188a8dcb6db0d80628815be2cf626c4d17cb3e826cebfca84adaff93ad492a"",""c6646214a1f377aa461a0163c213fc6b86a559a2d6ebd647d54c4eb00aaab015""]";;"curl -X POST ""https://api.koios.rest/api/v1/block_txs"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_block_hashes"":[""fb9087c9f1408a7bbd7b022fd294ab565fec8dd3a8ef091567482722a1fa4e30"",""60188a8dcb6db0d80628815be2cf626c4d17cb3e826cebfca84adaff93ad492a"",""c6646214a1f377aa461a0163c213fc6b86a559a2d6ebd647d54c4eb00aaab015""]}'"
|
14 |
+
/utxo_info;Transactions;UTxO Info;Get UTxO set for requested UTxO references;;_utxo_refs, _extended;"_utxo_refs: Array of Cardano utxo references in the form “hash#index”; _extended: Controls whether or not certain optional fields supported by a given endpoint are populated as a part of the call";_tx_hashes: string;"_tx_hashes”:[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94""]";;"curl -X POST ""https://api.koios.rest/api/v1/utxo_info"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_utxo_refs"":[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e#0"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94#0""],""_extended"":false}'"
|
15 |
+
/tx_info;Transactions;Transaction Information;Get detailed information about transaction(s);;_tx_hashes;Array of Cardano Transaction hashes;_tx_hashes: string;"_tx_hashes”:[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94""]";;"curl -X POST ""https://api.koios.rest/api/v1/tx_info"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_tx_hashes"":[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94""]}'"
|
16 |
+
/tx_metadata;Transactions;Transaction Metadata;Get metadata information (if any) for given transaction(s);;_tx_hashes;Array of Cardano Transaction hashes;_tx_hashes: string;"_tx_hashes”:[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94""]";;"curl -X POST ""https://api.koios.rest/api/v1/tx_metadata"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_tx_hashes"":[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94""]}'"
|
17 |
+
/tx_metalabels;Transactions;Transaction Metadata Labels;Get a list of all transaction metalabels;;;;;;;"curl -X GET ""https://api.koios.rest/api/v1/tx_metalabels"" -H ""accept: application/json"""
|
18 |
+
/tx_submit;Transactions;Submit Transaction;Submit an already serialized transaction to the network.;;cbor_data;Assuming ${data} is a raw binary serialized transaction on the file-system.;cbor: binary;;;"curl -X POST --header ""Content-Type: application/cbor"" --data-binary @${data} https://api.koios.rest/api/v1/submittx"
|
19 |
+
/tx_status;Transactions;Transaction Status;Get the number of block confirmations for a given transaction hash list;;_tx_hashes;Array of Cardano Transaction hashes;_tx_hashes: string;"_tx_hashes”:[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94""]";;"curl -X POST ""https://api.koios.rest/api/v1/tx_status"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_tx_hashes"":[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94""]}'"
|
20 |
+
/tx_utxos;Transactions;Transaction UTxOs;Get UTxO set (inputs/outputs) of transactions [DEPRECATED - Use /utxo_info instead].;;_tx_hashes;Array of Cardano Transaction hashes;_tx_hashes: string;"_tx_hashes”:[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94""]";;"curl -X POST ""https://api.koios.rest/api/v1/utxo_info"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_utxo_refs"":[""f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e#0"",""0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94#0""],""_extended"":false}'"
|
21 |
+
/address_info;Address;Address Information;Get address info - balance, associated stake address (if any) and UTxO set for given addresses;;_addresses;A Cardano payment/base address (bech32 encoded);_addresses: string;"_addresses"":[""addr1qy2jt0qpqz2z2z9zx5w4xemekkce7yderz53kjue53lpqv90lkfa9sgrfjuz6uvt4uqtrqhl2kj0a9lnr9ndzutx32gqleeckv"",""addr1q9xvgr4ehvu5k5tmaly7ugpnvekpqvnxj8xy50pa7kyetlnhel389pa4rnq6fmkzwsaynmw0mnldhlmchn2sfd589fgsz9dd0y""]";;"curl -X POST ""https://api.koios.rest/api/v1/address_info"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_addresses"":[""addr1qy2jt0qpqz2z2z9zx5w4xemekkce7yderz53kjue53lpqv90lkfa9sgrfjuz6uvt4uqtrqhl2kj0a9lnr9ndzutx32gqleeckv"",""addr1q9xvgr4ehvu5k5tmaly7ugpnvekpqvnxj8xy50pa7kyetlnhel389pa4rnq6fmkzwsaynmw0mnldhlmchn2sfd589fgsz9dd0y""]}'"
|
22 |
+
/address_assets;Address;Address Assets;Get the list of all the assets (policy, name and quantity) for given addresses;;_addresses;A Cardano payment/base address (bech32 encoded);_addresses: string;"_addresses"":[""addr1qy2jt0qpqz2z2z9zx5w4xemekkce7yderz53kjue53lpqv90lkfa9sgrfjuz6uvt4uqtrqhl2kj0a9lnr9ndzutx32gqleeckv"",""addr1q9xvgr4ehvu5k5tmaly7ugpnvekpqvnxj8xy50pa7kyetlnhel389pa4rnq6fmkzwsaynmw0mnldhlmchn2sfd589fgsz9dd0y""]";;"curl -X POST ""https://api.koios.rest/api/v1/address_assets"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_addresses"":[""addr1qy2jt0qpqz2z2z9zx5w4xemekkce7yderz53kjue53lpqv90lkfa9sgrfjuz6uvt4uqtrqhl2kj0a9lnr9ndzutx32gqleeckv"",""addr1q9xvgr4ehvu5k5tmaly7ugpnvekpqvnxj8xy50pa7kyetlnhel389pa4rnq6fmkzwsaynmw0mnldhlmchn2sfd589fgsz9dd0y""]}'"
|
23 |
+
/account_list;Stake Account;Account List;Get a list of all stake addresses that have atleast 1 transaction;;;;;;;"curl -X GET ""https://api.koios.rest/api/v1/account_list"" -H ""accept: application/json"""
|
24 |
+
/account_info;Stake Account;Account Information;Get the account information for given stake addresses;;_stake_address;Cardano staking address (reward account) in bech32 format for which the transactions are requested.;_stake_address: string;"_stake_addresses"":[""stake1uyrx65wjqjgeeksd8hptmcgl5jfyrqkfq0xe8xlp367kphsckq250"",""stake1uxpdrerp9wrxunfh6ukyv5267j70fzxgw0fr3z8zeac5vyqhf9jhy""]";;"curl -X POST ""https://api.koios.rest/api/v1/account_info"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_stake_addresses"":[""stake1uyrx65wjqjgeeksd8hptmcgl5jfyrqkfq0xe8xlp367kphsckq250"",""stake1uxpdrerp9wrxunfh6ukyv5267j70fzxgw0fr3z8zeac5vyqhf9jhy""]}'"
|
25 |
+
/account_txs;Stake Account;Account Txs;Get a list of all Txs for a given stake address (account);;_stake_address, _after_block_height;"Cardano staking address (reward account) in bech32 format for which the transactions are requested.; Block height for specifying time delta";"_stake_address: string; _after_block_height: number";"_stake_address: stake1u8yxtugdv63wxafy9d00nuz6hjyyp4qnggvc9a3vxh8yl0ckml2uz; _after_block_height: 100000";;"curl -X GET ""https://api.koios.rest/api/v1/account_txs?_stake_address=stake1u8yxtugdv63wxafy9d00nuz6hjyyp4qnggvc9a3vxh8yl0ckml2uz&_after_block_height=50000"" -H ""accept: application/json"""
|
26 |
+
/account_rewards;Stake Account;Account Rewards;Get the full rewards history (including MIR) for given stake addresses;;_stake_addresses, _epoch_no;"_stake_addresses: Array of Cardano stake address(es) in bech32 format; _epoch_no: Epoch number (required to get specific epoch data).";"_stake_address: string; _epoch_no: number";"_stake_address: stake1u8yxtugdv63wxafy9d00nuz6hjyyp4qnggvc9a3vxh8yl0ckml2uz; _epoch_no: 320";;"curl -X POST ""https://api.koios.rest/api/v1/account_rewards"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_stake_addresses"":[""stake1uyrx65wjqjgeeksd8hptmcgl5jfyrqkfq0xe8xlp367kphsckq250"",""stake1uxpdrerp9wrxunfh6ukyv5267j70fzxgw0fr3z8zeac5vyqhf9jhy""],""_epoch_no"":409}'"
|
27 |
+
/account_updates;Stake Account;Account Updates;Get the account updates (registration, deregistration, delegation and withdrawals) for given stake addresses;;_stake_address;Cardano staking address (reward account) in bech32 format for which the transactions are requested.;_stake_address: string;_stake_address: stake1u8yxtugdv63wxafy9d00nuz6hjyyp4qnggvc9a3vxh8yl0ckml2uz;;"curl -X POST ""https://api.koios.rest/api/v1/account_updates"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_stake_addresses"":[""stake1uyrx65wjqjgeeksd8hptmcgl5jfyrqkfq0xe8xlp367kphsckq250"",""stake1uxpdrerp9wrxunfh6ukyv5267j70fzxgw0fr3z8zeac5vyqhf9jhy""]}'"
|
28 |
+
/account_assets;Stake Account;Account Assets;Get the native asset balance for a given stake address;;_stake_address;Cardano staking address (reward account) in bech32 format for which the transactions are requested.;_stake_address: string;_stake_address: stake1u8yxtugdv63wxafy9d00nuz6hjyyp4qnggvc9a3vxh8yl0ckml2uz;;"curl -X POST ""https://api.koios.rest/api/v1/account_assets"" -H ""accept: application/json"" -H ""content-type: application/json"" -d '{""_stake_addresses"":[""stake1uyrx65wjqjgeeksd8hptmcgl5jfyrqkfq0xe8xlp367kphsckq250"",""stake1uxpdrerp9wrxunfh6ukyv5267j70fzxgw0fr3z8zeac5vyqhf9jhy""]}'"
|
29 |
+
/asset_list;Asset;Asset List;Get the list of all native assets (paginated);;;;;;;"curl -X GET ""https://api.koios.rest/api/v1/asset_list"" -H ""accept: application/json"""
|