You can use our Python SDK to create a dataset in Athina.
You can create a dataset and add rows programmatically using our Python SDK.If you are using any other language, then you can do so through some simple API requests.
from athina_client.datasets import Datasettry: dataset = Dataset.create( name='test_dataset', # the fields below are optional description="Optional description", tags=["tag1", "tag2"], project_name="project_name", # Note: project name should already exist on Athina metadata={ # freeform dictionary of metadata 'model': 'gpt-4o-mini', 'prompt': 'closed_qa/v1', 'dataset_type': 'classification', 'dataset_source': 'https://example.com', } )except Exception as e: print(f"Failed to create dataset: {e}")
The name of the dataset must be unique, otherwise the request will throw an
exception.
4. Add rows to the dataset
try: Dataset.add_rows( dataset_id=dataset.id, rows=[ { 'query': 'What is the capital of France?', 'context': ['France is a country in Western Europe.', 'Paris is the capital of France.'], 'response': 'Paris', 'expected_response': 'Paris' }, ], )except Exception as e: print(f"Failed to add rows: {e}")
Currently, a dataset can have a maximum of 10000 rows. If the number of rows >
10000, the API will return an exception with status code 400.
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"Athina","colors":{"primary":"#1976D2","light":"#419BF4","dark":"#1976D2"},"favicon":"/logo/light.svg","logo":{"light":"https://mintlify.s3.us-west-1.amazonaws.com/athinaai/logo/light.svg","dark":"https://mintlify.s3.us-west-1.amazonaws.com/athinaai/logo/dark.svg"},"api":{"mdx":{"server":null,"auth":{"method":"key","name":"athina-api-key"}}},"navbar":{"links":[{"label":"AI Hub","href":"https://hub.athina.ai"},{"label":"Website","href":"https://athina.ai"}],"primary":{"type":"button","label":"Sign-up","href":"https://app.athina.ai/"}},"footer":{"socials":{"twitter":"https://twitter.com/AthinaAI","linkedin":"https://linkedin.com/company/athina-ai"}},"integrations":{"ga4":{"measurementId":"G-KZVC5R2GB1"}},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"athinaai","hasAudioNarration":false,"actualSubdomain":"athinaai","customDomains":["docs.athina.ai"],"gitSource":{"type":"github","owner":"athina-ai","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"feedback":{"thumbs":false},"entitlements":{},"buildId":"6ae91e667acc70e71f351389:success","clientVersion":"0.0.4102","searchFilterCounts":[{"language":"default","tag":"Documentation","count":166},{"language":"default","tag":"Docs","count":79},{"language":"default","tag":"API / SDK Reference","count":54},{"language":"default","tag":"Evals","count":52},{"language":"default","tag":"Datasets","count":37},{"language":"default","tag":"Guides","count":23},{"language":"default","tag":"Logging","count":21},{"language":"default","tag":"Preset Evals","count":15},{"language":"default","tag":"Prompts","count":14},{"language":"default","tag":"Logging LLM Inferences","count":13}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"datasets/create-dataset/create-dataset-via-python-sdk","slug":"/datasets/create-dataset/create-dataset-via-python-sdk","pageMetadata":{"title":"Via Python SDK","description":"You can use our Python SDK to create a dataset in Athina.","icon":"code","href":"/datasets/create-dataset/create-dataset-via-python-sdk"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"You can use our Python SDK to create a dataset in Athina.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{CodeBlock,Heading,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`You can create a dataset and add rows programmatically using our Python SDK.`}),`\n`,_jsx(_components.p,{children:`If you are using any other language, then you can do so through some simple API requests.`}),`\n`,_jsx(Heading,{level:`2`,id:`create-dataset-via-sdk`,children:`Create Dataset via SDK`}),`\n`,_jsx(_components.p,{children:_jsxs(_components.strong,{children:[`1. Install the `,_jsx(_components.code,{children:`athina`}),` package`]})}),`\n`,_jsx(CodeBlock,{numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`pip install athina`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`client`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`2. Set your API keys`})}),`\n`,_jsx(_components.p,{children:`If you are using the python SDK, then can set the API keys like this:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`4`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` os`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` athina_client.keys `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` AthinaApiKey`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`AthinaApiKey.set_key(os.getenv(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'ATHINA_API_KEY'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`3. Create a dataset and log it to athina`})}),`\n`,_jsx(CodeBlock,{numberOfLines:`19`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`19`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` athina_client.datasets `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Dataset`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` dataset `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Dataset.create(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'test_dataset'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # the fields below are optional`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` description`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Optional description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` tags`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tag1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tag2\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` project_name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"project_name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Note: project name should already exist on Athina`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` metadata`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # freeform dictionary of metadata`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'model'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'gpt-4o-mini'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'prompt'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'closed_qa/v1'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'dataset_type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'classification'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'dataset_source'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'https://example.com'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`except`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` Exception`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` e:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Failed to create dataset: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`e`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Tip,{children:_jsx(_components.p,{children:`The name of the dataset must be unique, otherwise the request will throw an\nexception.`})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`4. Add rows to the dataset`})}),`\n`,_jsx(CodeBlock,{numberOfLines:`14`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Dataset.add_rows(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` dataset_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`dataset.id,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` rows`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'query'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'What is the capital of France?'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'context'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'France is a country in Western Europe.'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Paris is the capital of France.'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'response'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Paris'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'expected_response'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Paris'`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`except`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` Exception`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` e:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Failed to add rows: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`e`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`You can also find the `,_jsx(_components.code,{children:`dataset_id`}),` from the URL when you open the dataset\nthrough `,_jsx(_components.a,{href:`https://app.athina.ai/develop`,children:`https://app.athina.ai/develop`}),`.`]})}),`\n`,_jsx(Tip,{children:_jsx(_components.p,{children:`Currently, a dataset can have a maximum of 10000 rows. If the number of rows >\n10000, the API will return an exception with status code 400.`})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Via Python SDK","description":"You can use our Python SDK to create a dataset in Athina.","icon":"code","href":"/datasets/create-dataset/create-dataset-via-python-sdk"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Create Dataset via SDK","slug":"create-dataset-via-sdk","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"athinaai","siteName":"Athina","title":"Via Python SDK - Athina","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"originalFileLocation":"datasets/create-dataset/create-dataset-via-python-sdk.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"You can use our Python SDK to create a dataset in Athina.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Athina\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/athinaai/_generated/favicon/apple-touch-icon.png?v=3\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/athinaai/_generated/favicon/favicon-32x32.png?v=3\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/athinaai/_generated/favicon/favicon-16x16.png?v=3\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/athinaai/_generated/favicon/favicon.ico?v=3\">\u003cmeta data-mint-head property=\"og:title\" content=\"Via Python SDK - Athina\">\u003cmeta data-mint-head property=\"og:description\" content=\"You can use our Python SDK to create a dataset in Athina.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Athina\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.athina.ai/datasets/create-dataset/create-dataset-via-python-sdk\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://athinaai.mintlify.site/_mintlify/api/og/v2?division=Creating+a+dataset\u0026amp;title=Via+Python+SDK\u0026amp;description=You+can+use+our+Python+SDK+to+create+a+dataset+in+Athina.\u0026amp;theme=64652801f93e763e814fdf35\u0026amp;signature=6f8153209338d4916e628635b0f5d5e779f0c5aa57672da7762443616736fcdd\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Via Python SDK - Athina\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"You can use our Python SDK to create a dataset in Athina.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://athinaai.mintlify.site/_mintlify/api/og/v2?division=Creating+a+dataset\u0026amp;title=Via+Python+SDK\u0026amp;description=You+can+use+our+Python+SDK+to+create+a+dataset+in+Athina.\u0026amp;theme=64652801f93e763e814fdf35\u0026amp;signature=6f8153209338d4916e628635b0f5d5e779f0c5aa57672da7762443616736fcdd\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"https://mintlify.s3.us-west-1.amazonaws.com/athinaai/_generated/favicon/browserconfig.xml?v=3\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Athina\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#1976D2\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.athina.ai/datasets/create-dataset/create-dataset-via-python-sdk\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/datasets/create-dataset/create-dataset-via-python-sdk.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.athina.ai/#organization\",\"name\":\"Athina\",\"url\":\"https://docs.athina.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintlify.s3.us-west-1.amazonaws.com/athinaai/logo/light.svg\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.athina.ai#website\",\"name\":\"Athina\",\"url\":\"https://docs.athina.ai\",\"publisher\":{\"@id\":\"https://docs.athina.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.athina.ai/datasets/create-dataset/create-dataset-via-python-sdk#webpage\",\"url\":\"https://docs.athina.ai/datasets/create-dataset/create-dataset-via-python-sdk\",\"name\":\"Via Python SDK\",\"description\":\"You can use our Python SDK to create a dataset in Athina.\",\"isPartOf\":{\"@id\":\"https://docs.athina.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.athina.ai/datasets/create-dataset/create-dataset-via-python-sdk#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.athina.ai/datasets/create-dataset/create-dataset-via-python-sdk#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Datasets\",\"item\":\"https://docs.athina.ai/datasets/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating a dataset\",\"item\":\"https://docs.athina.ai/datasets/create-dataset/create-dataset\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Via Python SDK\",\"item\":\"https://docs.athina.ai/datasets/create-dataset/create-dataset-via-python-sdk\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.athina.ai/datasets/create-dataset/create-dataset-via-python-sdk#article\",\"headline\":\"Via Python SDK\",\"name\":\"Via Python SDK\",\"description\":\"You can use our Python SDK to create a dataset in Athina.\",\"url\":\"https://docs.athina.ai/datasets/create-dataset/create-dataset-via-python-sdk\",\"mainEntityOfPage\":{\"@id\":\"https://docs.athina.ai/datasets/create-dataset/create-dataset-via-python-sdk#webpage\"},\"publisher\":{\"@id\":\"https://docs.athina.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.athina.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Athina\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Athina\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/datasets/create-dataset/create-dataset-via-python-sdk.md","siteName":"Athina","nav":{"global":null,"anchors":[{"anchor":"Documentation","icon":"book-open","tabs":[{"tab":"Docs","groups":[{"group":"Getting Started","pages":[{"title":"Athina AI","icon":"hand-wave","sidebarTitle":"Introduction","mode":"wide","href":"/overview"},{"title":"Getting Started with Athina","sidebarTitle":"Getting Started","icon":"rocket","href":"/getting-started"}]},{"group":"Datasets","pages":[{"title":"Introduction","sidebarTitle":"Introduction","icon":"table","href":"/datasets/overview"},{"group":"Creating a dataset","icon":"plus","pages":[{"title":"Create a Dataset","icon":"table","href":"/datasets/create-dataset/create-dataset"},{"title":"From Logs","icon":"bars","href":"/datasets/create-dataset/create-dataset-from-logs"},{"title":"Upload File","description":"You can upload a JSONL, CSV, or JSON file to create a dataset in Athina.","icon":"file-lines","href":"/datasets/create-dataset/create-dataset-from-file"},{"title":"Via Python SDK","icon":"code","href":"/datasets/create-dataset/create-dataset-via-python-sdk"},{"title":"Via API","description":"You can use simple POST API requests to add rows to a dataset.","icon":"code","href":"/datasets/create-dataset/create-dataset-via-api"},{"title":"Import a HuggingFace Dataset","icon":"face-smiling-hands","href":"/datasets/create-dataset/import_huggingface_dataset"},{"title":"Generate a Synthetic Dataset","icon":"wand-magic-sparkles","href":"/datasets/create-dataset/generate-synthetic-dataset"}]},{"group":"Dynamic Columns","icon":"play","pages":[{"title":"Overview","icon":"play","href":"/datasets/dynamic-columns/dynamic-columns"},{"title":"Run Prompt","icon":"wand-magic-sparkles","href":"/datasets/dynamic-columns/dynamic-columns-run-prompt"},{"title":"API Call","icon":"globe","href":"/datasets/dynamic-columns/dynamic-columns-api-call"},{"title":"Classification","icon":"split","href":"/datasets/dynamic-columns/dynamic-columns-classification"},{"title":"Extract Entities","icon":"play","href":"/datasets/dynamic-columns/dynamic-columns-extract-entities"},{"title":"Code Execution","icon":"square-code","href":"/datasets/dynamic-columns/dynamic-columns-code-execution"}]},{"title":"Run evaluations (UI)","icon":"bolt-lightning","href":"/datasets/run-eval"},{"title":"View Metrics","icon":"chart-line","href":"/datasets/metrics"},{"title":"Run Experiments","icon":"flask","href":"/datasets/run-experiment"},{"title":"Compare datasets","icon":"columns-3","href":"/datasets/compare-datasets"},{"title":"Join Datasets","icon":"file-import","href":"/datasets/join-datasets"},{"title":"Export / Download Datasets","icon":"file-export","href":"/datasets/export-datasets"},{"title":"SQL Notebook","sidebarTitle":"SQL Notebook","icon":"database","href":"/datasets/sql"},{"title":"Dataset Automations","sidebarTitle":"Automations","icon":"diagram-nested","href":"/datasets/automations"},{"title":"Manage Datasets","sidebarTitle":"Manage Datasets","icon":"folders","href":"/datasets/management"},{"title":"Delete a Dataset","icon":"trash","href":"/datasets/delete-dataset"}]},{"group":"Evals","pages":[{"title":"Athina Evals","sidebarTitle":"Overview","icon":"hand-wave","href":"/evals/overview"},{"title":"Quick Start","icon":"rocket","href":"/evals/quickstart"},{"title":"Online Evals","sidebarTitle":"Online Evals","icon":"circle-check","href":"/evals/online-evals"},{"title":"Offline Evals","icon":"bolt-lightning","href":"/evals/offline-evals"},{"title":"Preset Evaluators","sidebarTitle":"Preset Evaluators","icon":"grid","href":"/evals/preset-evals"},{"sidebarTitle":"Custom Evals","title":"Custom Evals","icon":"wrench","href":"/evals/custom-evals"},{"title":"Running Evals in UI","icon":"bolt-lightning","href":"/evals/running-evals-in-ui"},{"title":"Running Evals via SDK","icon":"code","href":"/evals/running-evals-via-sdk"},{"title":"Running Evals in CI/CD","icon":"code-commit","href":"/evals/running-evals-ci-cd"},{"group":"Why Athina Evals?","icon":"book","pages":[{"title":"Open Source Evaluations","icon":"github","href":"/evals/why-athina/open-source-evals"},{"title":"Why Athina Evals","icon":"face-thinking","href":"/evals/why-athina/why-athina-evals"}]},{"title":"Eval Cookbooks","sidebarTitle":"Cookbooks","icon":"code","href":"/evals/cookbooks"}]},{"group":"Flows","pages":[{"title":"Flows","sidebarTitle":"Overview","icon":"arrow-progress","href":"/flows/overview"},{"title":"Concepts","sidebarTitle":"Concepts","icon":"cube","href":"/flows/concepts"},{"title":"Variables in Flows","sidebarTitle":"Variables","icon":"brackets-curly","href":"/flows/variables"},{"title":"Sharing Flows","sidebarTitle":"Sharing Flows","icon":"share","href":"/flows/share-flows"},{"title":"Flow Templates","sidebarTitle":"Flow Templates","icon":"cube","href":"/flows/templates"},{"group":"Blocks","pages":[{"title":"Blocks","sidebarTitle":"Overview","icon":"cube","href":"/flows/blocks/overview"},{"title":"Search","sidebarTitle":"Search","icon":"magnifying-glass","href":"/flows/blocks/search"},{"title":"Code Execution","sidebarTitle":"Code Execution","icon":"rectangle-code","href":"/flows/blocks/code_execution"},{"title":"Knowledge Retrieval","sidebarTitle":"Knowledge Retrieval","icon":"book","href":"/flows/blocks/knowledge"}]}]},{"group":"Annotation","pages":[{"title":"Annotation","sidebarTitle":"Overview","icon":"highlighter-line","href":"/annotations/overview"},{"title":"Annotation Metrics","sidebarTitle":"Metrics","icon":"chart-line","href":"/annotations/metrics"},{"title":"Configure an Annotation Project","sidebarTitle":"Configure Project","icon":"clipboard-list","href":"/annotations/configure-project"},{"title":"View Annotated Data","sidebarTitle":"View Data","icon":"eye","href":"/annotations/view-annotated-data"},{"title":"Review Annotation Entries","sidebarTitle":"Review Entries","icon":"table","href":"/annotations/review-entries"},{"title":"Export Annotated Data","sidebarTitle":"Export Data","icon":"download","href":"/annotations/export-data"},{"title":"Annotation Permissions","sidebarTitle":"Permissions","icon":"shield-check","href":"/annotations/permissions"}]},{"group":"Prompts","pages":[{"title":"Overview","icon":"input-text","href":"/prompts/overview"},{"title":"Concepts","icon":"book","href":"/prompts/concepts"},{"title":"Prompt Syntax","icon":"code","href":"/prompts/syntax"},{"title":"Create Prompt Template","icon":"plus","href":"/prompts/create-prompt"},{"title":"Prompt Versioning","icon":"code-branch","href":"/prompts/prompt-versioning"},{"title":"Delete Prompt Slug","icon":"trash","href":"/prompts/delete-prompt"},{"title":"List Prompt Slugs","icon":"list","href":"/prompts/list-prompts"},{"title":"Duplicate Prompt Slug","icon":"copy","href":"/prompts/duplicate-prompt"},{"title":"Run Prompt","icon":"play","href":"/prompts/run-prompt"},{"title":"Multi-Prompt Playground","icon":"layer-group","href":"/prompts/run-multiple-prompts"},{"title":"Run Evaluations on a Prompt Response","icon":"check","href":"/prompts/prompt-evals"},{"title":"Organize Prompts","icon":"folder","href":"/prompts/organization"}]},{"group":"Monitoring","pages":[{"title":"Athina Monitoring","sidebarTitle":"Overview","icon":"bars","href":"/monitoring/overview"},{"title":"Inference Trace","icon":"magnifying-glass","href":"/monitoring/inference-trace"},{"title":"Analytics and Insights","sidebarTitle":"Analytics","icon":"chart-line","href":"/monitoring/analytics"},{"title":"Query Topic Classification","sidebarTitle":"Topic Classification","icon":"tag","href":"/monitoring/topic-classification"},{"title":"How can I export my logged inferences?","sidebarTitle":"Export Data from Athina","icon":"file-export","href":"/monitoring/export-data"},{"title":"Continuous Evaluation","icon":"circle-check","href":"/monitoring/continuous-eval"},{"title":"Model Performance Metrics","icon":"chart-line","href":"/monitoring/performance-metrics"}]},{"group":"Settings","pages":[{"title":"Custom Models","icon":"cube","href":"/settings/custom-models"},{"title":"Sampling Evals","icon":"circle-check","href":"/settings/sampling-evals"},{"title":"Credits","icon":"coin","href":"/settings/credits"}]},{"group":"Integrations","pages":[{"title":"Integrations","icon":"plug","href":"/integrations"}]},{"group":"Self Hosting","pages":[{"title":"Self-Hosting","icon":"cloud","href":"/self-hosting/on-AWS"},{"title":"Self-Hosting On Azure","icon":"cloud","href":"/self-hosting/on-Azure"}]},{"group":"Datasets","pages":[{"title":"Import a HuggingFace Dataset","icon":"face-smiling-hands","href":"/datasets/create-dataset/import_huggingface_dataset"}]}]},{"tab":"API / SDK Reference","pages":[{"title":"API / SDK Reference","href":"/api-reference/logging/overview"}]},{"tab":"Guides","pages":[{"title":"Guides","href":"/guides/overview"}]},{"tab":"FAQs","pages":[{"title":"FAQs","href":"/faqs/data-policy"}]}]},{"anchor":"Open-Source Evals","href":"https://github.com/athina-ai/athina-evals","icon":"github"},{"anchor":"Blog","href":"https://blog.athina.ai/","icon":"book"},{"anchor":"Email us","href":"mailto:hello@athina.ai","icon":"envelope"},{"anchor":"Book a call","href":"https://cal.com/shiv-athina/30min","icon":"calendar"}]},"basePath":"","title":"Via Python SDK - Athina","buildId":"dpl_596ePT575z4qnAFksq1biRW97aLY","deploymentId":"dpl_596ePT575z4qnAFksq1biRW97aLY","dynamics":[],"chunks":[]}