Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dataset migration #57

Merged
merged 1 commit into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion athina/datasets/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class DatasetRow:
class Dataset:
id: str
source: str
data_source: str
name: str
description: Optional[str] = None
language_model_id: Optional[str] = None
Expand All @@ -39,6 +40,7 @@ def create(name: str, description: Optional[str] = None, language_model_id: Opti
"""
dataset_data = {
"source": "dev_sdk",
"data_source": "dev_sdk",
"name": name,
"description": description,
"language_model_id": language_model_id,
Expand All @@ -53,7 +55,7 @@ def create(name: str, description: Optional[str] = None, language_model_id: Opti
created_dataset_data = AthinaApiService.create_dataset(dataset_data)
except Exception as e:
raise
dataset = Dataset(id=created_dataset_data['id'], source=created_dataset_data['source'], name=created_dataset_data['name'], description=created_dataset_data['description'], language_model_id=created_dataset_data['language_model_id'], prompt_template=created_dataset_data['prompt_template'])
dataset = Dataset(id=created_dataset_data['id'], source=created_dataset_data['source'], data_source=created_dataset_data['data_source'], name=created_dataset_data['name'], description=created_dataset_data['description'], language_model_id=created_dataset_data['language_model_id'], prompt_template=created_dataset_data['prompt_template'])
return dataset

@staticmethod
Expand Down
4 changes: 2 additions & 2 deletions athina/services/athina_api_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def create_dataset(
Creates a dataset by calling the Athina API
"""
try:
endpoint = f"{API_BASE_URL}/api/v1/dataset"
endpoint = f"{API_BASE_URL}/api/v1/dataset_v2"
response = requests.post(
endpoint,
headers=AthinaApiService._headers(),
Expand Down Expand Up @@ -166,7 +166,7 @@ def add_dataset_rows(dataset_id: str, rows: List[Dict]):
- CustomException: If the API call fails or returns an error.
"""
try:
endpoint = f"{API_BASE_URL}/api/v1/dataset/{dataset_id}/add-rows"
endpoint = f"{API_BASE_URL}/api/v1/dataset_v2/{dataset_id}/add-rows"
response = requests.post(
endpoint,
headers=AthinaApiService._headers(),
Expand Down
26 changes: 23 additions & 3 deletions examples/dataset_creation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,20 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/akshat_g/athina/repos/athina-evals/.venv/lib/python3.9/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020\n",
" warnings.warn(\n",
"/Users/akshat_g/athina/repos/athina-evals/.venv/lib/python3.9/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n"
]
}
],
"source": [
"import os\n",
"from athina.datasets import Dataset\n",
Expand All @@ -17,7 +28,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -39,6 +50,15 @@
" print(f\"Failed to create dataset: {e}\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(dataset.id) "
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down