diff --git a/README.md b/README.md index 1affa88..8be1844 100644 --- a/README.md +++ b/README.md @@ -72,26 +72,26 @@ Welcome to Labelbox Notebooks! These documents are directly linked from our Labe - - Exporting to CSV - Open In Colab - Open In Github - - - Composite mask export - Open In Colab - Open In Github - Export data Open In Colab Open In Github + + Exporting to CSV + Open In Colab + Open In Github + Export v1 to v2 migration support Open In Colab Open In Github + + Composite mask export + Open In Colab + Open In Github + @@ -106,20 +106,20 @@ Welcome to Labelbox Notebooks! These documents are directly linked from our Labe + + Multimodal chat project + Open In Colab + Open In Github + Prompt response projects Open In Colab Open In Github - Queue management - Open In Colab - Open In Github - - - Multimodal chat project - Open In Colab - Open In Github + Webhooks + Open In Colab + Open In Github Project setup @@ -127,9 +127,9 @@ Welcome to Labelbox Notebooks! These documents are directly linked from our Labe Open In Github - Webhooks - Open In Colab - Open In Github + Queue management + Open In Colab + Open In Github @@ -145,15 +145,35 @@ Welcome to Labelbox Notebooks! These documents are directly linked from our Labe + + LLM data generation + Open In Colab + Open In Github + + + Tiled + Open In Colab + Open In Github + PDF Open In Colab Open In Github - Conversational LLM - Open In Colab - Open In Github + DICOM + Open In Colab + Open In Github + + + Audio + Open In Colab + Open In Github + + + Offline multimodal chat evaluation + Open In Colab + Open In Github Text @@ -161,55 +181,35 @@ Welcome to Labelbox Notebooks! These documents are directly linked from our Labe Open In Github - Video - Open In Colab - Open In Github + Conversational LLM + Open In Colab + Open In Github - Tiled - Open In Colab - Open In Github + HTML + Open In Colab + Open In Github Prompt response Open In Colab Open In Github - - Audio - Open In Colab - Open In Github - - - Offline multimodal chat evaluation - Open In Colab - Open In Github - Image Open In Colab Open In Github + + Video + Open In Colab + Open In Github + Conversational Open In Colab Open In Github - - LLM data generation - Open In Colab - Open In Github - - - HTML - Open In Colab - Open In Github - - - DICOM - Open In Colab - Open In Github - @@ -224,11 +224,21 @@ Welcome to Labelbox Notebooks! These documents are directly linked from our Labe + + Langchain + Open In Colab + Open In Github + Huggingface custom embeddings Open In Colab Open In Github + + Import YOLOv8 annotations + Open In Colab + Open In Github + Meta SAM Open In Colab @@ -239,16 +249,6 @@ Welcome to Labelbox Notebooks! These documents are directly linked from our Labe Open In Colab Open In Github - - Langchain - Open In Colab - Open In Github - - - Import YOLOv8 annotations - Open In Colab - Open In Github - @@ -264,9 +264,9 @@ Welcome to Labelbox Notebooks! These documents are directly linked from our Labe - Custom metrics basics - Open In Colab - Open In Github + Custom metrics demo + Open In Colab + Open In Github Model slices @@ -279,9 +279,9 @@ Welcome to Labelbox Notebooks! These documents are directly linked from our Labe Open In Github - Custom metrics demo - Open In Colab - Open In Github + Custom metrics basics + Open In Colab + Open In Github @@ -298,9 +298,9 @@ Welcome to Labelbox Notebooks! These documents are directly linked from our Labe - Conversational predictions - Open In Colab - Open In Github + PDF predictions + Open In Colab + Open In Github Text predictions @@ -308,24 +308,19 @@ Welcome to Labelbox Notebooks! These documents are directly linked from our Labe Open In Github - PDF predictions - Open In Colab - Open In Github - - - HTML predictions - Open In Colab - Open In Github + Geospatial predictions + Open In Colab + Open In Github - Image predictions - Open In Colab - Open In Github + Conversational predictions + Open In Colab + Open In Github - Geospatial predictions - Open In Colab - Open In Github + Conversational LLM predictions + Open In Colab + Open In Github Video predictions @@ -333,9 +328,14 @@ Welcome to Labelbox Notebooks! These documents are directly linked from our Labe Open In Github - Conversational LLM predictions - Open In Colab - Open In Github + Image predictions + Open In Colab + Open In Github + + + HTML predictions + Open In Colab + Open In Github diff --git a/basics/user_management.ipynb b/basics/user_management.ipynb index 40b8abf..a190b99 100644 --- a/basics/user_management.ipynb +++ b/basics/user_management.ipynb @@ -1,16 +1,18 @@ { + "nbformat": 4, + "nbformat_minor": 5, + "metadata": {}, "cells": [ { - "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", "\n" - ] + ], + "cell_type": "markdown" }, { - "cell_type": "markdown", "metadata": {}, "source": [ "\n", @@ -22,10 +24,10 @@ "\n", "" - ] + ], + "cell_type": "markdown" }, { - "cell_type": "markdown", "metadata": {}, "source": [ "# User Management\n", @@ -36,151 +38,136 @@ " * assign users to projects\n", " * set / update / revoke project role\n", " * delete users from org" - ] + ], + "cell_type": "markdown" }, { - "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "%pip install \"labelbox[data]\"" - ] + ], + "cell_type": "code", + "outputs": [], + "execution_count": null }, { - "cell_type": "code", - "execution_count": null, - "id": "f8f0b762", "metadata": {}, - "outputs": [], "source": [ "import labelbox as lb\n", "import os\n", "from labelbox.schema.user_group import UserGroup, UserGroupColor" - ] + ], + "cell_type": "code", + "outputs": [], + "execution_count": null }, { - "cell_type": "markdown", - "id": "0a9ce6de", "metadata": {}, "source": [ "# API Key and Client\n", "Provide a valid api key below in order to properly connect to the Labelbox Client." - ] + ], + "cell_type": "markdown" }, { - "cell_type": "code", - "execution_count": null, - "id": "45d4c8b9", "metadata": {}, - "outputs": [], "source": [ "# Add your api key\n", "API_KEY = None\n", "client = lb.Client(api_key=API_KEY)\n", "organization = client.get_organization()" - ] + ], + "cell_type": "code", + "outputs": [], + "execution_count": null }, { - "cell_type": "markdown", - "id": "9eb49c63", "metadata": {}, "source": [ "## Roles\n", "* When inviting a new user to an organization, there are various roles to select from.\n", "* All available roles to your org can be accessed via `client.get_roles()`" - ] + ], + "cell_type": "markdown" }, { - "cell_type": "code", - "execution_count": null, - "id": "23b3306c", "metadata": {}, - "outputs": [], "source": [ "roles = client.get_roles()\n", "for name, role in roles.items():\n", " print(role.name, \":\", role.uid)" - ] + ], + "cell_type": "code", + "outputs": [], + "execution_count": null }, { - "cell_type": "markdown", - "id": "45b90b0d", "metadata": {}, "source": [ "* Above we printed out all of the roles available to the current org.\n", "* Notice the `NONE`. That is for project level roles" - ] + ], + "cell_type": "markdown" }, { - "cell_type": "markdown", - "id": "9e648548", "metadata": {}, "source": [ "## Create\n", "* Users are created by sending an invite\n", "* An email will be sent to them and they will be asked to join your organization" - ] + ], + "cell_type": "markdown" }, { - "cell_type": "markdown", - "id": "03992ca5", "metadata": {}, "source": [ "### Organization Level Permissions\n", "* Invite a new labeler with labeling permissions on all projects" - ] + ], + "cell_type": "markdown" }, { - "cell_type": "code", - "execution_count": null, - "id": "5a0bb7a3", "metadata": {}, - "outputs": [], "source": [ "# First make sure that you have enough seats:\n", "organization.invite_limit()" - ] + ], + "cell_type": "code", + "outputs": [], + "execution_count": null }, { - "cell_type": "code", - "execution_count": null, - "id": "476aaaa1", "metadata": {}, - "outputs": [], "source": [ "USER_EMAIL = \"\"\n", "invite = organization.invite_user(USER_EMAIL, roles[\"LABELER\"])" - ] + ], + "cell_type": "code", + "outputs": [], + "execution_count": null }, { - "cell_type": "code", - "execution_count": null, - "id": "5b5629c6", "metadata": {}, - "outputs": [], "source": [ "print(invite.created_at)\n", "print(invite.organization_role_name)\n", "print(invite.email)" - ] + ], + "cell_type": "code", + "outputs": [], + "execution_count": null }, { - "cell_type": "markdown", - "id": "dfdcf919", "metadata": {}, "source": [ "### Project Level Permissions\n", "* Invite a new labeler with labeling permissions specific to a set of projects\n", "* Here we set organization level permissions to Roles.NONE to indicate that the user only has project level permissions" - ] + ], + "cell_type": "markdown" }, { - "cell_type": "code", - "execution_count": null, - "id": "781110d0", "metadata": {}, - "outputs": [], "source": [ "USER_EMAIL = \"\"\n", "project = client.create_project(\n", @@ -190,45 +177,41 @@ "invite = organization.invite_user(\n", " USER_EMAIL, roles[\"NONE\"], project_roles=[project_role]\n", ")" - ] + ], + "cell_type": "code", + "outputs": [], + "execution_count": null }, { - "cell_type": "markdown", - "id": "1766b081", "metadata": {}, "source": [ "## Read\n", "* Outstanding invites cannot be queried for at this time. This information can be found in the members tab of the web app.\n", "* You are able to query for members once they have joined." - ] + ], + "cell_type": "markdown" }, { - "cell_type": "code", - "execution_count": null, - "id": "5233d339", "metadata": {}, - "outputs": [], "source": [ "users = list(organization.users())\n", "print(users[0])" - ] + ], + "cell_type": "code", + "outputs": [], + "execution_count": null }, { - "cell_type": "markdown", - "id": "00f84675", "metadata": {}, "source": [ "## Update\n", "* There is no update on invites. Instead you must delete and resend them\n", "* You can update User roles" - ] + ], + "cell_type": "markdown" }, { - "cell_type": "code", - "execution_count": null, - "id": "b36aff4e", "metadata": {}, - "outputs": [], "source": [ "# Get all users in the organization\n", "users = organization.users()\n", @@ -251,23 +234,21 @@ "# Make the user a labeler for the current project\n", "user.upsert_project_role(project, roles[\"LABELER\"])\n", "print(user.org_role())" - ] + ], + "cell_type": "code", + "outputs": [], + "execution_count": null }, { - "cell_type": "markdown", - "id": "31107d47", "metadata": {}, "source": [ "## Delete\n", "You can remove users from projects and your organization using the SDK. Invites can only be deleted using the **Members** tab on the web platform at this moment." - ] + ], + "cell_type": "markdown" }, { - "cell_type": "code", - "execution_count": null, - "id": "9ae61408", "metadata": {}, - "outputs": [], "source": [ "# Remove the user from a project\n", "user.remove_from_project(project)\n", @@ -275,23 +256,21 @@ "user.update_org_role(roles[\"NONE\"])\n", "# Remove the user from the org\n", "organization.remove_user(user)" - ] + ], + "cell_type": "code", + "outputs": [], + "execution_count": null }, { - "cell_type": "markdown", - "id": "390da677", "metadata": {}, "source": [ "## Manage user groups\n", "### Create user groups" - ] + ], + "cell_type": "markdown" }, { - "cell_type": "code", - "execution_count": null, - "id": "83cc4ddc", "metadata": {}, - "outputs": [], "source": [ "# Define a user group\n", "user_group = UserGroup(\n", @@ -304,22 +283,20 @@ "\n", "# Create the defined user group\n", "created_group = user_group.create() " - ] + ], + "cell_type": "code", + "outputs": [], + "execution_count": null }, { - "cell_type": "markdown", - "id": "9f713aa8", "metadata": {}, "source": [ "### Update user groups" - ] + ], + "cell_type": "markdown" }, { - "cell_type": "code", - "execution_count": null, - "id": "4daac0ab", "metadata": {}, - "outputs": [], "source": [ "# Define the user group properties to be updated\n", "user_group.name = \"Updated User Group Name\"\n", @@ -339,14 +316,13 @@ "\n", "# Push the changes to the group\n", "user_group.update()" - ] + ], + "cell_type": "code", + "outputs": [], + "execution_count": null }, { - "cell_type": "code", - "execution_count": null, - "id": "1143d3f5", "metadata": {}, - "outputs": [], "source": [ "## Remove all members and projects from the group\n", "user_group.users = []\n", @@ -355,33 +331,30 @@ "\n", "# Push the changes to the group\n", "user_group.update()" - ] + ], + "cell_type": "code", + "outputs": [], + "execution_count": null }, { - "cell_type": "code", - "execution_count": null, - "id": "905ff680", "metadata": {}, - "outputs": [], "source": [ "# Delete a user group\n", "user_group.delete()" - ] + ], + "cell_type": "code", + "outputs": [], + "execution_count": null }, { - "cell_type": "markdown", - "id": "ca6f223c", "metadata": {}, "source": [ "## Get user group info" - ] + ], + "cell_type": "markdown" }, { - "cell_type": "code", - "execution_count": null, - "id": "f87ce871", "metadata": {}, - "outputs": [], "source": [ "# Get info of a user group\n", "user_group.get()\n", @@ -397,32 +370,27 @@ " print(f\"Found user group 'example_name' with ID: {example_group.id}\")\n", "else:\n", " print(\"No user group named 'example_name' found\")" - ] + ], + "cell_type": "code", + "outputs": [], + "execution_count": null }, { - "cell_type": "markdown", - "id": "4895b32a", "metadata": {}, "source": [ "## Cleanup\n", "Delete the project if you no longer need it:" - ] + ], + "cell_type": "markdown" }, { - "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "project.delete()" - ] - } - ], - "metadata": { - "language_info": { - "name": "python" + ], + "cell_type": "code", + "outputs": [], + "execution_count": null } - }, - "nbformat": 4, - "nbformat_minor": 5 -} + ] +} \ No newline at end of file diff --git a/project_configuration/multimodal_chat_project.ipynb b/project_configuration/multimodal_chat_project.ipynb index ba120e0..feb2189 100644 --- a/project_configuration/multimodal_chat_project.ipynb +++ b/project_configuration/multimodal_chat_project.ipynb @@ -32,16 +32,16 @@ "source": [ "# Multimodal chat project setup\n", "\n", - "This notebook will provide an example workflow of setting up a multimodal Chat (MMC) Project with the Labelbox-Python SDK.\n", - "Multimodal Chat Projects are set up differently than other projects with its own unique method and modifications to existing methods:\n", + "This notebook provides an example workflow of setting up a multimodal chat (MMC) project using the Labelbox Python SDK.\n", + "MMC projects require the following unique methods and modifications to existing methods:\n", "\n", - "- `client.create_model_evaluation_project`: The main method used to create a live multimodal Chat project.\n", + "- `client.create_model_evaluation_project`: The main method to create a live MMC project.\n", " \n", - "- `client.create_offline_model_evaluation_project`: The main method used to create a offline multimodal Chat project.\n", + "- `client.create_offline_model_evaluation_project`: The main method to create an offline MMC project.\n", "\n", - "- `client.create_ontology`: Methods used to create Labelbox ontologies for LMC project this requires an `ontology_kind` parameter set to `lb.OntologyKind.ModelEvaluation`.\n", + "- `client.create_ontology`: The method to create ontologies for MNC projects. Requires an `ontology_kind` parameter set to `lb.OntologyKind.ModelEvaluation`.\n", "\n", - "- `client.create_ontology_from_feature_schemas`: Similar to `client.create_ontology` but from a list of `feature schema ids` designed to allow you to use existing features instead of creating new features. This also requires an `ontology_kind` set to `lb.OntologyKind.ModelEvaluation`." + "- `client.create_ontology_from_feature_schemas`: Similar to `client.create_ontology` but takes a list of `feature schema ids` to allow you to use existing features instead of creating new features. Also requires an `ontology_kind` set to `lb.OntologyKind.ModelEvaluation`." ], "cell_type": "markdown" }, @@ -70,13 +70,13 @@ "metadata": {}, "source": [ "## API key and client\n", - "Please provide a valid API key below to connect to the Labelbox client properly. For more information, please review the [Create API key guide](https://docs.labelbox.com/reference/create-api-key)." + "Provide a valid API key below to connect to the Labelbox client properly. For more information, see [Create API keys](https://docs.labelbox.com/reference/create-api-key)." ], "cell_type": "markdown" }, { "metadata": {}, - "source": "API_KEY = None\nclient = lb.Client(api_key=API_KEY)", + "source": "API_KEY = \"\"\nclient = lb.Client(api_key=API_KEY)", "cell_type": "code", "outputs": [], "execution_count": null @@ -84,16 +84,16 @@ { "metadata": {}, "source": [ - "## Example: Create multimodal Chat project\n", + "## Example: Create a MMC project\n", "\n", - "The steps to creating a multimodal Chat Projects through the Labelbox-Python SDK are similar to creating a regular project. However, they vary slightly, and we will showcase the different methods in this example workflow." + "Creating a MMC project using the Labelbox Python SDK follows the same general steps as a regular project, with a few differences. This example workflow highlights those differences." ], "cell_type": "markdown" }, { "metadata": {}, "source": [ - "### Create a multimodal chat ontology\n", + "### Create a MMC ontology\n", "\n", "You can create ontologies for multimodal chat projects in the same way as other project ontologies using two methods: `client.create_ontology` and `client.create_ontology_from_feature_schemas`. The only additional requirement is to pass an ontology_kind parameter, which needs to be set to `lb.OntologyKind.ModelEvaluation`." ], @@ -104,13 +104,13 @@ "source": [ "#### Option A: `client.create_ontology`\n", "\n", - "Typically, you create ontologies and generate the associated features simultaneously. Below is an example of creating an ontology for your multimodal chat project using supported tools and classifications; for information on supported annotation types, visit our [multimodal chat evaluation guide](https://docs.labelbox.com/docs/multimodal-chat#supported-annotation-types) guide." + "Typically, you create ontologies and generate the associated features simultaneously. The following example of creating an ontology for your MMC project using supported tools and classifications. See [Supported annotation types](https://docs.labelbox.com/docs/multimodal-chat-evaluation-editor#supported-annotation-types) for the annotation types you can include in an MMC ontology." ], "cell_type": "markdown" }, { "metadata": {}, - "source": "ontology_builder = lb.OntologyBuilder(\n tools=[\n lb.Tool(\n tool=lb.Tool.Type.MESSAGE_SINGLE_SELECTION,\n name=\"single select feature\",\n ),\n lb.Tool(\n tool=lb.Tool.Type.MESSAGE_MULTI_SELECTION,\n name=\"multi select feature\",\n ),\n lb.Tool(tool=lb.Tool.Type.MESSAGE_RANKING, name=\"ranking feature\"),\n ],\n classifications=[\n lb.Classification(\n class_type=lb.Classification.Type.CHECKLIST,\n name=\"checklist feature\",\n options=[\n lb.Option(value=\"option 1\", label=\"option 1\"),\n lb.Option(value=\"option 2\", label=\"option 2\"),\n ],\n ),\n lb.Classification(\n class_type=lb.Classification.Type.RADIO,\n name=\"radio_question\",\n options=[\n lb.Option(value=\"first_radio_answer\"),\n lb.Option(value=\"second_radio_answer\"),\n ],\n ),\n ],\n)\n\n# Create ontology\nontology = client.create_ontology(\n \"LMC ontology\",\n ontology_builder.asdict(),\n media_type=lb.MediaType.Conversational,\n ontology_kind=lb.OntologyKind.ModelEvaluation,\n)", + "source": "ontology_builder = lb.OntologyBuilder(\n tools=[\n lb.Tool(\n tool=lb.Tool.Type.MESSAGE_SINGLE_SELECTION,\n name=\"single select feature\",\n ),\n lb.Tool(\n tool=lb.Tool.Type.MESSAGE_MULTI_SELECTION,\n name=\"multi select feature\",\n ),\n lb.Tool(tool=lb.Tool.Type.MESSAGE_RANKING, name=\"ranking feature\"),\n ],\n classifications=[\n lb.Classification(\n class_type=lb.Classification.Type.CHECKLIST,\n name=\"checklist feature\",\n options=[\n lb.Option(value=\"option 1\", label=\"option 1\"),\n lb.Option(value=\"option 2\", label=\"option 2\"),\n ],\n ),\n lb.Classification(\n class_type=lb.Classification.Type.RADIO,\n name=\"radio_question\",\n options=[\n lb.Option(value=\"first_radio_answer\"),\n lb.Option(value=\"second_radio_answer\"),\n ],\n ),\n ],\n)\n\n# Create ontology\nontology = client.create_ontology(\n \"MMC ontology\",\n ontology_builder.asdict(),\n media_type=lb.MediaType.Conversational,\n ontology_kind=lb.OntologyKind.ModelEvaluation,\n)", "cell_type": "code", "outputs": [], "execution_count": null @@ -119,13 +119,13 @@ "metadata": {}, "source": [ "### Option B: `client.create_ontology_from_feature_schemas`\n", - "Ontologies can also be created with feature schema IDs. This makes your ontologies with existing features compared to generating new features. You can get these features by going to the _Schema_ tab inside Labelbox. (uncomment the below code block for this option)" + "You can create ontologies using feature schema IDs to reuse existing feature schemas instead of generating new ones. To obtain these IDs, go to the **Schema** tab on the web platform." ], "cell_type": "markdown" }, { "metadata": {}, - "source": "# ontology = client.create_ontology_from_feature_schemas(\n# \"LMC ontology\",\n# feature_schema_ids=[\"\", # optional\n)\n\n\ndef make_data_rows(dataset_id=None):\n # If a dataset ID is provided, fetch the dataset using that ID.\n # Otherwise, create a new dataset with the specified name.\n if dataset_id:\n dataset = client.get_dataset(dataset_id)\n else:\n dataset = client.create_dataset(name=\"example live mmc dataset\")\n\n # Helper function to generate a single data row\n def generate_data(ind):\n return {\n \"row_data\": { # The chat data format\n \"type\": \"application/vnd.labelbox.conversational.model-chat-evaluation\",\n \"draft\": True,\n \"rootMessageIds\": [],\n \"actors\": {},\n \"version\": 2,\n \"messages\": {},\n },\n \"global_key\": f\"global_key_{dataset.uid}_{ind}\",\n \"metadata_fields\": [{\"name\": \"tag\", \"value\": \"val_tag\"}],\n \"attachments\": [\n {\n \"type\": \"IMAGE_OVERLAY\",\n \"value\": \"https://storage.googleapis.com/labelbox-sample-datasets/Docs/rgb.jpg\",\n }\n ],\n }\n\n # Generate a list of 100 data rows\n data_list = [generate_data(ind) for ind in range(100)]\n\n # Upload the generated data rows to the dataset\n task = dataset.create_data_rows(data_list)\n print(\"Processing task \", task.uid) # Print the unique ID of the task\n task.wait_till_done()\n\n # Ensure that the task status is 'COMPLETE' to confirm success\n assert task.status == \"COMPLETE\"\n\n # Return the dataset object\n return dataset\n\n\n# Create a new data set. Alternatively, pass an existing dataset ID\ndataset = make_data_rows()\n\n# Retrieve the data row IDs from the dataset\ndata_row_ids = [data_row.uid for data_row in dataset.data_rows()]\n\n# Send data rows to the project\nbatch = project.create_batch(\n name=\"mmc-batch\", # each batch in a project must have a unique name\n data_rows=data_row_ids, # data row IDs to include in the batch\n priority=1, # priority between 1(highest) - 5(lowest)\n)\n\nprint(f\"Batch: {batch}\")", "cell_type": "code", "outputs": [], "execution_count": null @@ -196,24 +192,24 @@ { "metadata": {}, "source": [ - "## Setting up model config\n", - "You can create, delete, attach and remove model configs from your Live Multimodal Chat project through the Labelbox-Python SDK. These are the model configs that you will be evaluating for your responses. " + "## Set up model config\n", + "You can create, delete, attach, and remove model configs for evaluating your live MMC responses using the SDK." ], "cell_type": "markdown" }, { "metadata": {}, "source": [ - "### Creating model config\n", - "The main method associated with creating a model config is `client.create_model_config`. This method takes the following parameters:\n", "\n", - "- `name`: Name of the model config.\n", + "### Create model configs\n", "\n", - "- `model_id`: The ID of the model to configure. You must obtain this through the UI by navigating to the Model tab, selecting the model you are trying to use, and copying the id inside the URL. For supported models, visit the [Live Multimodal Chat page](https://docs.labelbox.com/docs/live-multimodal-chat#supported-annotation-types).\n", + "The method for creating a model config is `client.create_model_config`. It takes the following parameters:\n", "\n", - "- `inference_params`: JSON of model configuration parameters. This will vary depending on the model you are trying to set up. It is recommended to first set up a model config inside the UI to learn all the associated parameters.\n", + "- `name`: The name of the model config.\n", "\n", - "For the example below, we will be setting up a Google Gemini 1.5 Pro model config." + "- `model_id`: The ID of the model to configure. To get this value, go to the Model tab, select your model, and copy the ID from the URL.\n", + "\n", + "- `inference_params`: Model configuration parameters in the JSON format. Each model has unique parameters." ], "cell_type": "markdown" }, @@ -227,7 +223,7 @@ { "metadata": {}, "source": [ - "### Attaching model config to project\n", + "### Attach model config to project\n", "You can attach and remove model configs to your project using `project.add_model_config` or `project.remove_model_config`. Both methods take just a `model_config` ID." ], "cell_type": "markdown" @@ -243,13 +239,16 @@ "metadata": {}, "source": [ "### Delete model config\n", - "You can also delete model configs using the `client.delete_model_config`. You just need to pass in the `model_config` ID in order to delete your model config. You can obtain this ID from your created model config above or get the model configs directly from your project using `project.project_model_configs` and then iterating through the list of model configs attached to your project. Uncomment the code below to delete your model configs. " + "Use `project.delete_project_model_config()` or `client.delete_model_config` to delete model configs. Both methods require the `model_config` ID as a parameter. You can obtain this ID in one of the following ways:\n", + "\n", + "- From the response when you create a model config\n", + "- By accessing `project.project_model_configs` and iterating through the list of model configs attached to your project" ], "cell_type": "markdown" }, { "metadata": {}, - "source": "# model_configs = project.project_model_configs()\n\n# for model_config in model_configs:\n# client.delete_model_config(model_config.uid)", + "source": "model_configs = project.project_model_configs()\n\nfor model_config in model_configs:\n client.delete_model_config(model_config.uid)", "cell_type": "code", "outputs": [], "execution_count": null @@ -257,9 +256,9 @@ { "metadata": {}, "source": [ - "### Mark project setup as completed\n", + "### Mark project setup as complete\n", "\n", - "Once you have finalized your project and set up your model configs, you must mark the project setup as completed.\n", + "Once you have finalized your project and set up your model configs, you must mark the project setup as complete.\n", "\n", "**Once the project is marked as \"setup complete\", a user can not add, modify, or delete existing project model configs.**" ], @@ -272,33 +271,18 @@ "outputs": [], "execution_count": null }, - { - "metadata": {}, - "source": [ - "## Exporting Live Multimodal Chat project\n", - "Exporting from a Live Multimodal Chat project works the same as exporting from other projects. In this example, your export will be shown as empty unless you have created labels inside the Labelbox platform. Please review our [Live Multimodal Chat Export](https://docs.labelbox.com/reference/export-live-multimodal-chat-annotations) guide for a sample export." - ], - "cell_type": "markdown" - }, - { - "metadata": {}, - "source": "# Start export from project\nexport_task = project.export()\nexport_task.wait_till_done()\n\n# Conditional if task has errors\nif export_task.has_errors():\n export_task.get_buffered_stream(stream_type=lb.StreamType.ERRORS).start(\n stream_handler=lambda error: print(error))\n\nif export_task.has_result():\n # Start export stream\n stream = export_task.get_buffered_stream()\n\n # Iterate through data rows\n for data_row in stream:\n print(data_row.json)", - "cell_type": "code", - "outputs": [], - "execution_count": null - }, { "metadata": {}, "source": [ "## Clean up\n", "\n", - "This section serves as an optional clean-up step to delete the Labelbox assets created within this guide. You will need to uncomment the delete methods shown." + "This section serves as an optional clean-up step to delete the Labelbox assets created within this guide." ], "cell_type": "markdown" }, { "metadata": {}, - "source": "# project.delete()\n# client.delete_unused_ontology(ontology.uid)\n# dataset.delete()", + "source": "project.delete()\nclient.delete_unused_ontology(ontology.uid)\ndataset.delete()", "cell_type": "code", "outputs": [], "execution_count": null diff --git a/requirements-dev.lock b/requirements-dev.lock index 9e45e2c..1b1aa86 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -20,7 +20,7 @@ click==8.1.8 commonmark==0.9.1 # via rich databooks==1.3.10 -decorator==5.1.1 +decorator==5.2.1 # via ipython executing==2.2.0 # via stack-data @@ -28,15 +28,17 @@ gitdb==4.0.12 # via gitpython gitpython==3.1.44 # via databooks -ipython==8.32.0 +ipython==9.1.0 # via black +ipython-pygments-lexers==1.1.1 + # via ipython jedi==0.19.2 # via ipython matplotlib-inline==0.1.7 # via ipython mypy-extensions==1.0.0 # via black -numpy==2.2.3 +numpy==2.2.4 # via pandas packaging==24.2 # via black @@ -47,7 +49,7 @@ pathspec==0.12.1 # via black pexpect==4.9.0 # via ipython -platformdirs==4.3.6 +platformdirs==4.3.7 # via black # via yapf prompt-toolkit==3.0.50 @@ -56,16 +58,17 @@ ptyprocess==0.7.0 # via pexpect pure-eval==0.2.3 # via stack-data -pydantic==2.10.6 +pydantic==2.11.3 # via databooks -pydantic-core==2.27.2 +pydantic-core==2.33.1 # via pydantic pygments==2.19.1 # via ipython + # via ipython-pygments-lexers # via rich python-dateutil==2.9.0.post0 # via pandas -pytz==2025.1 +pytz==2025.2 # via pandas rich==12.6.0 # via databooks @@ -85,14 +88,17 @@ tomli==2.2.1 traitlets==5.14.3 # via ipython # via matplotlib-inline -typer==0.15.1 +typer==0.15.2 # via databooks -typing-extensions==4.12.2 +typing-extensions==4.13.2 # via databooks # via pydantic # via pydantic-core # via typer -tzdata==2025.1 + # via typing-inspection +typing-inspection==0.4.0 + # via pydantic +tzdata==2025.2 # via pandas wcwidth==0.2.13 # via prompt-toolkit