-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
inital commit for yellowhammer jupyter assistant
- Loading branch information
Showing
12 changed files
with
946 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "2671fc38-c9ca-49ef-948a-abb7815ca2b9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%reload_ext yellowhammer" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "32c5ffc5-ea83-458c-8e5a-75bb15da8a2d", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import os, getpass\n", | ||
"os.environ['LLM_PROVIDER'] = \"OPENAI\"\n", | ||
"os.environ['LLM_API_KEY'] = getpass.getpass(\"Enter your LLM API key\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "2f61e78f-b8a3-4f0c-b5e4-503af30019f3", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"os.environ[\"DATALAB_API_KEY\"] = getpass.getpass(\"Enter your Datalab API key\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "f44cabeb-58ef-4ccd-86d7-5cb04a3f8643", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/markdown": [ | ||
"Datalab is a data management platform designed for scientists and researchers to manage their experimental data efficiently. It allows users to organize, analyze, and visualize their data through a structured interface. Datalab uses the concept of \"data blocks\" to handle files associated with samples, enabling users to parse data according to scientific schemas and create plots for better data interpretation. The platform also provides an API for programmatic access, allowing users to automate tasks such as data entry, file uploads, and data analysis." | ||
], | ||
"text/plain": [ | ||
"<IPython.core.display.Markdown object>" | ||
] | ||
}, | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"%%llm\n", | ||
"What is datalab?" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"id": "d10442e5-7c5c-40cd-becf-9c2e9a79fd45", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/markdown": [ | ||
"To create a new sample in Datalab with the specified ID, name, and formula, we will use the `create_item` method of the `DatalabClient`. This method requires the item ID, item type, and the data that matches the schema for samples. In this case, we will set the `item_id` to 'llm-test3', the `name` to 'virtual sample', and the `chemform` to 'RbCl'." | ||
], | ||
"text/plain": [ | ||
"<IPython.core.display.Markdown object>" | ||
] | ||
}, | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"%%llm\n", | ||
"Create a sample with ID llm-test3, sample name \"virtual sample\", formula RbCl" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"id": "33c0e59e-586d-48f3-aa5f-f6fa743dcc96", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"/Users/yue/Library/CloudStorage/OneDrive-Personal/code/yellowhammer/.venv/lib/python3.10/site-packages/datalab_api/_base.py:165: UserWarning: Found API URL https://demo-api.datalab-org.io in HTML meta tag. Creating client with this URL instead.\n", | ||
" warnings.warn(\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"from datalab_api import DatalabClient\n", | ||
"import os\n", | ||
"with DatalabClient(\"https://demo.datalab-org.io\") as client:\n", | ||
" json_data = {\n", | ||
" \"name\": \"virtual sample\",\n", | ||
" \"chemform\": \"RbCl\"\n", | ||
" }\n", | ||
" client.create_item(item_id=\"llm-test3\", item_type=\"samples\", item_data=json_data)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "yellowhammer", | ||
"language": "python", | ||
"name": "yellowhammer" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.9" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.