Project

Use this class to represent the AI project that we are working on and to interact with datasets and experiments in it.
from ragas_experimental.model.notion_model import NotionModel

source

Project

 Project (project_id:str, ragas_api_client:Optional[ragas_experimental.bac
          kends.ragas_api_client.RagasApiClient]=None)

Initialize self. See help(type(self)) for accurate signature.

RAGAS_APP_TOKEN = "api-key"
RAGAS_API_BASE_URL = "https://api.dev.app.ragas.io"

os.environ["RAGAS_APP_TOKEN"] = RAGAS_APP_TOKEN
os.environ["RAGAS_API_BASE_URL"] = RAGAS_API_BASE_URL
#project = Project.create("Demo Project")
project = Project(project_id="1ef0843b-231f-4a2c-b64d-d39bcee9d830")
project
Project(name='yann-lecun-wisdom')

source

Project.get

 Project.get (name:str, ragas_api_client:Optional[ragas_experimental.backe
              nds.ragas_api_client.RagasApiClient]=None)

Get an existing project by name.

Project.get("SuperMe")
Project(name='SuperMe')
#project.delete()

Manage datasets


source

create_dataset_columns

 create_dataset_columns (project_id, dataset_id, columns,
                         create_dataset_column_func)

source

Project.create_dataset

 Project.create_dataset (model:Type[pydantic.main.BaseModel],
                         name:Optional[str]=None)

*Create a new dataset database.

Args: name (str): Name of the dataset model (NotionModel): Model class defining the database structure

Returns: Dataset: A new dataset object for managing entries*

import ragas_experimental.typing as rt
# create an example dataset
class TestModel(BaseModel):
    id: int
    name: str
    description: str
    tags: t.Literal["tag1", "tag2", "tag3"]
    tags_color_coded: t.Annotated[t.Literal["red", "green", "blue"], rt.Select(colors=["red", "green", "blue"])]
    url: t.Annotated[str, rt.Url()] = "https://www.google.com"
test_dataset = project.create_dataset(TestModel)
test_dataset
Dataset(name=TestModel, model=TestModel, len=0)

source

Project.get_dataset_by_id

 Project.get_dataset_by_id (dataset_id:str, model)

Get an existing dataset by name.

project.get_dataset_by_id(test_dataset.dataset_id, TestModel)
Dataset(name=TestModel, model=TestModel, len=0)

source

Project.get_dataset

 Project.get_dataset (dataset_name:str, model)

Get an existing dataset by name.

project.get_dataset("TestModel", TestModel)
Dataset(name=TestModel, model=TestModel, len=0)