### Install Gradient Python SDK Source: https://gradientai-sdk.digitalocean.com/api/python Installs the Gradient Python SDK from PyPI. This command is used for initial setup and upgrades. ```bash pip install --pre gradient ``` -------------------------------- ### Example Response: Indexing Job Details (JSON) Source: https://gradientai-sdk.digitalocean.com/api/resources/knowledge_bases/subresources/indexing_jobs/methods/create Provides an example of a successful response from the DigitalOcean API after starting an indexing job. The JSON object details the job's status, completion, data sources, timestamps, and unique identifiers for the knowledge base and the job itself. ```json { "job": { "completed_datasources": 123, "created_at": "2023-01-01T00:00:00Z", "data_source_uuids": [ "example string" ], "finished_at": "2023-01-01T00:00:00Z", "knowledge_base_uuid": "123e4567-e89b-12d3-a456-426614174000", "phase": "BATCH_JOB_PHASE_UNKNOWN", "started_at": "2023-01-01T00:00:00Z", "status": "INDEX_JOB_STATUS_UNKNOWN", "tokens": 123, "total_datasources": 123, "total_items_failed": "12345", "total_items_indexed": "12345", "total_items_skipped": "12345", "updated_at": "2023-01-01T00:00:00Z", "uuid": "123e4567-e89b-12d3-a456-426614174000" } } ``` -------------------------------- ### Install Gradient Python SDK with aiohttp Source: https://gradientai-sdk.digitalocean.com/api/python Installs the Gradient Python SDK with support for the aiohttp backend for enhanced concurrency in asynchronous operations. ```bash pip install --pre gradient[aiohttp] ``` -------------------------------- ### Agent Creation Response Example Source: https://gradientai-sdk.digitalocean.com/api/python/resources/agents/methods/create Provides a comprehensive JSON example of the response received after successfully creating an agent. This includes details about API keys, chatbot configurations, deployment status, functions, and knowledge bases. ```json { "agent": { "anthropic_api_key": { "created_at": "2023-01-01T00:00:00Z", "created_by": "12345", "deleted_at": "2023-01-01T00:00:00Z", "name": "example name", "updated_at": "2023-01-01T00:00:00Z", "uuid": "123e4567-e89b-12d3-a456-426614174000" }, "api_key_infos": [ { "created_at": "2023-01-01T00:00:00Z", "created_by": "12345", "deleted_at": "2023-01-01T00:00:00Z", "name": "example name", "secret_key": "example string", "uuid": "123e4567-e89b-12d3-a456-426614174000" } ], "api_keys": [ { "api_key": "example string" } ], "chatbot": { "button_background_color": "example string", "logo": "example string", "name": "example name", "primary_color": "example string", "secondary_color": "example string", "starting_message": "example string" }, "chatbot_identifiers": [ { "agent_chatbot_identifier": "123e4567-e89b-12d3-a456-426614174000" } ], "child_agents": [], "conversation_logs_enabled": true, "created_at": "2023-01-01T00:00:00Z", "deployment": { "created_at": "2023-01-01T00:00:00Z", "name": "example name", "status": "STATUS_UNKNOWN", "updated_at": "2023-01-01T00:00:00Z", "url": "example string", "uuid": "123e4567-e89b-12d3-a456-426614174000", "visibility": "VISIBILITY_UNKNOWN" }, "description": "example string", "functions": [ { "api_key": "example string", "created_at": "2023-01-01T00:00:00Z", "created_by": "12345", "description": "example string", "faas_name": "example name", "faas_namespace": "example name", "input_schema": {}, "name": "example name", "output_schema": {}, "updated_at": "2023-01-01T00:00:00Z", "url": "example string", "uuid": "123e4567-e89b-12d3-a456-426614174000" } ], "guardrails": [ { "agent_uuid": "123e4567-e89b-12d3-a456-426614174000", "created_at": "2023-01-01T00:00:00Z", "default_response": "example string", "description": "example string", "guardrail_uuid": "123e4567-e89b-12d3-a456-426614174000", "is_attached": true, "is_default": true, "metadata": {}, "name": "example name", "priority": 123, "type": "GUARDRAIL_TYPE_UNKNOWN", "updated_at": "2023-01-01T00:00:00Z", "uuid": "123e4567-e89b-12d3-a456-426614174000" } ], "if_case": "example string", "instruction": "example string", "k": 123, "knowledge_bases": [ { "added_to_agent_at": "2023-01-01T00:00:00Z", "created_at": "2023-01-01T00:00:00Z", "database_id": "123e4567-e89b-12d3-a456-426614174000", "embedding_model_uuid": "123e4567-e89b-12d3-a456-426614174000", "is_public": true, "last_indexing_job": { "completed_datasources": 123, "created_at": "2023-01-01T00:00:00Z", "data_source_uuids": [ "example string" ], "finished_at": "2023-01-01T00:00:00Z", "knowledge_base_uuid": "123e4567-e89b-12d3-a456-426614174000", "phase": "BATCH_JOB_PHASE_UNKNOWN", "started_at": "2023-01-01T00:00:00Z", "status": "INDEX_JOB_STATUS_UNKNOWN", "tokens": 123, "total_datasources": 123, "total_items_failed": "12345", "total_items_indexed": "12345", "total_items_skipped": "12345", "updated_at": "2023-01-01T00:00:00Z", "uuid": "123e4567-e89b-12d3-a456-426614174000" }, "name": "example name", "project_id": "123e4567-e89b-12d3-a456-426614174000", "region": "example string", "tags": [ "example string" ], "updated_at": "2023-01-01T00:00:00Z", "user_id": "user_id", "uuid": "123e4567-e89b-12d3-a456-426614174000" } ], "logging_config": { "galileo_project_id": "123e4567-e89b-12d3-a456-426614174000", "galileo_project_name": "example name", "insights_enabled": true, "insights_enabled_at": "2023-01-01T00:00:00Z", "log_stream_id": "123e4567-e89b-12d3-a456-426614174000", "log_stream_name": "example name" }, "max_tokens": 123, "model": { "agreement": { "description": "example string", "name": "example name", "url": "example string", "uuid": "123e4567-e89b-12d3-a456-426614174000" }, "created_at": "2023-01-01T00:00:00Z", "inference_name": "example name", "name": "example name", "slug": "example string", "updated_at": "2023-01-01T00:00:00Z", "uuid": "123e4567-e89b-12d3-a456-426614174000" }, "name": "example name", "parent_agent_uuid": "123e4567-e89b-12d3-a456-426614174000", "pinned_tools": [], "prompt_settings": { "temperature": 123.45 }, "reverse_proxy_enabled": true, "sharing_config": { "created_at": "2023-01-01T00:00:00Z", "deleted_at": "2023-01-01T00:00:00Z", "name": "example name", "updated_at": "2023-01-01T00:00:00Z", "uuid": "123e4567-e89b-12d3-a456-426614174000" }, "template_config": {}, "tool_code_execution_enabled": true, "updated_at": "2023-01-01T00:00:00Z", "use_examples": true, "user_id": "user_id", "uuid": "123e4567-e89b-12d3-a456-426614174000", "version": "example string", "version_uuid": "123e4567-e89b-12d3-a456-426614174000" } } ``` -------------------------------- ### Example Response for Block Storage Volume Creation Source: https://gradientai-sdk.digitalocean.com/api/resources/gpu_droplets/subresources/volumes/methods/create This example shows a successful response (HTTP 200) after creating a block storage volume. It details the properties of the created volume, such as its description, filesystem type, name, size, and tags. ```JSON { "volume": { "description": "Block store for examples", "filesystem_label": "example", "filesystem_type": "ext4", "name": "example", "size_gigabytes": 10, "tags": [ "base-image", "prod" ] } } ``` -------------------------------- ### List Workspaces using Python Source: https://gradientai-sdk.digitalocean.com/api/resources/agents/subresources/evaluation_metrics/subresources/workspaces/methods/list Provides a Python example for listing all AI workspaces by making a GET request to the DigitalOcean API's /v2/gen-ai/workspaces endpoint. This involves using a library to handle HTTP requests and requires an access token for authentication. ```python import requests url = "https://api.digitalocean.com/v2/gen-ai/workspaces" headers = { "Authorization": "Bearer $DIGITALOCEAN_ACCESS_TOKEN" } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") print(response.text) ``` -------------------------------- ### List Knowledge Bases Example Response (JSON) Source: https://gradientai-sdk.digitalocean.com/api/resources/knowledge_bases/methods/list Provides an example of a successful JSON response when listing knowledge bases. It includes details about the knowledge bases, pagination links, and meta information. ```json { "knowledge_bases": [ { "added_to_agent_at": "2023-01-01T00:00:00Z", "created_at": "2023-01-01T00:00:00Z", "database_id": "123e4567-e89b-12d3-a456-426614174000", "embedding_model_uuid": "123e4567-e89b-12d3-a456-426614174000", "is_public": true, "last_indexing_job": { "completed_datasources": 123, "created_at": "2023-01-01T00:00:00Z", "data_source_uuids": [ "example string" ], "finished_at": "2023-01-01T00:00:00Z", "knowledge_base_uuid": "123e4567-e89b-12d3-a456-426614174000", "phase": "BATCH_JOB_PHASE_UNKNOWN", "started_at": "2023-01-01T00:00:00Z", "status": "INDEX_JOB_STATUS_UNKNOWN", "tokens": 123, "total_datasources": 123, "total_items_failed": "12345", "total_items_indexed": "12345", "total_items_skipped": "12345", "updated_at": "2023-01-01T00:00:00Z", "uuid": "123e4567-e89b-12d3-a456-426614174000" }, "name": "example name", "project_id": "123e4567-e89b-12d3-a456-426614174000", "region": "example string", "tags": [ "example string" ], "updated_at": "2023-01-01T00:00:00Z", "user_id": "user_id", "uuid": "123e4567-e89b-12d3-a456-426614174000" } ], "links": { "pages": { "first": "example string", "last": "example string", "next": "example string", "previous": "example string" } }, "meta": { "page": 123, "pages": 123, "total": 123 } } ``` -------------------------------- ### Example JSON Response for Volume Snapshots Source: https://gradientai-sdk.digitalocean.com/api/resources/gpu_droplets/subresources/volumes/subresources/snapshots/methods/list This is an example JSON response when successfully listing snapshots for a DigitalOcean volume. It includes metadata, pagination links, and a list of snapshot objects. ```json { "meta": { "total": 1 }, "links": { "pages": { "last": "https://api.digitalocean.com/v2/images?page=2", "next": "https://api.digitalocean.com/v2/images?page=2" } }, "snapshots": [ { "id": "8eb4d51a-873f-11e6-96bf-000f53315a41", "created_at": "2020-09-30T18:56:12Z", "min_disk_size": 10, "name": "big-data-snapshot1475261752", "regions": [ "nyc1" ], "resource_id": "82a48a18-873f-11e6-96bf-000f53315a41", "resource_type": "volume", "size_gigabytes": 0, "tags": [ "string" ] } ] } ``` -------------------------------- ### OpenAI API Key Creation Response Example Source: https://gradientai-sdk.digitalocean.com/api/resources/models/subresources/providers/subresources/openai/methods/create Provides an example of a successful response (HTTP 200) when creating an OpenAI API key. The response includes detailed information about the created API key. ```json { "api_key_info": { "created_at": "2023-01-01T00:00:00Z", "created_by": "12345", "deleted_at": "2023-01-01T00:00:00Z", "models": [ { "agreement": { "description": "example string", "name": "example name", "url": "example string", "uuid": "123e4567-e89b-12d3-a456-426614174000" }, "created_at": "2023-01-01T00:00:00Z", "inference_name": "example name", "inference_version": "example string", "is_foundational": true, "metadata": {}, "name": "example name", "parent_uuid": "123e4567-e89b-12d3-a456-426614174000", "provider": "MODEL_PROVIDER_DIGITALOCEAN", "updated_at": "2023-01-01T00:00:00Z", "upload_complete": true, "url": "example string", "usecases": [ "MODEL_USECASE_AGENT", "MODEL_USECASE_GUARDRAIL" ], "uuid": "123e4567-e89b-12d3-a456-426614174000", "version": { "major": 123, "minor": 123, "patch": 123 } } ], "name": "example name", "updated_at": "2023-01-01T00:00:00Z", "uuid": "123e4567-e89b-12d3-a456-426614174000" } } ``` -------------------------------- ### Example JSON Response for Listed Agents Source: https://gradientai-sdk.digitalocean.com/api/python/resources/agents/methods/list Provides a detailed example of the JSON structure returned when listing agents. This includes information about agent configurations, associated models, deployment details, and metadata. ```json { "agents": [ { "chatbot": { "button_background_color": "example string", "logo": "example string", "name": "example name", "primary_color": "example string", "secondary_color": "example string", "starting_message": "example string" }, "chatbot_identifiers": [ { "agent_chatbot_identifier": "123e4567-e89b-12d3-a456-426614174000" } ], "created_at": "2021-01-01T00:00:00Z", "deployment": { "created_at": "2023-01-01T00:00:00Z", "name": "example name", "status": "STATUS_UNKNOWN", "updated_at": "2023-01-01T00:00:00Z", "url": "example string", "uuid": "123e4567-e89b-12d3-a456-426614174000", "visibility": "VISIBILITY_UNKNOWN" }, "description": "This is a chatbot that can help you with your questions.", "if_case": "if talking about the weather use this route", "instruction": "Hello, how can I help you?", "k": 5, "max_tokens": 100, "model": { "agreement": { "description": "example string", "name": "example name", "url": "example string", "uuid": "123e4567-e89b-12d3-a456-426614174000" }, "created_at": "2023-01-01T00:00:00Z", "inference_name": "example name", "inference_version": "example string", "is_foundational": true, "metadata": {}, "name": "example name", "parent_uuid": "123e4567-e89b-12d3-a456-426614174000", "provider": "MODEL_PROVIDER_DIGITALOCEAN", "updated_at": "2023-01-01T00:00:00Z", "upload_complete": true, "url": "example string", "usecases": [ "MODEL_USECASE_AGENT", "MODEL_USECASE_GUARDRAIL" ], "uuid": "123e4567-e89b-12d3-a456-426614174000", "version": { "major": 123, "minor": 123, "patch": 123 } }, "name": "My Agent", "project_id": "12345678-1234-1234-1234-123456789012", "provide_citations": true, "region": "\"tor1\"", "retrieval_method": "RETRIEVAL_METHOD_UNKNOWN", "route_created_at": "2021-01-01T00:00:00Z", "route_created_by": "12345678", "route_name": "Route Name", "route_uuid": "\"12345678-1234-1234-1234-123456789012\"", "tags": [ "example string" ], "temperature": 0.5, "template": { "created_at": "2023-01-01T00:00:00Z", "description": "example string", "guardrails": [ { "priority": 123, "uuid": "123e4567-e89b-12d3-a456-426614174000" } ], "instruction": "example string", "k": 123, "knowledge_bases": [ { "added_to_agent_at": "2023-01-01T00:00:00Z", "created_at": "2023-01-01T00:00:00Z", "database_id": "123e4567-e89b-12d3-a456-426614174000", "embedding_model_uuid": "123e4567-e89b-12d3-a456-426614174000", "is_public": true, "last_indexing_job": { "completed_datasources": 123, "created_at": "2023-01-01T00:00:00Z", "data_source_uuids": [ "example string" ] } } ] } } ] } ``` -------------------------------- ### DigitalOcean Agent Configuration Example Source: https://gradientai-sdk.digitalocean.com/api/resources/agents/methods/list This example demonstrates a typical agent configuration object, including a UUID, name, URL, user ID, and version hash. It also includes parameters like temperature and top_p, common in generative AI models. ```json { "top_p": 0.9, "updated_at": "2021-01-01T00:00:00Z", "url": "https://example.com/agent", "user_id": "12345678", "uuid": "\"12345678-1234-1234-1234-123456789012\"", "version_hash": "example string" } ``` -------------------------------- ### List Anthropic API Keys Response Example (JSON) Source: https://gradientai-sdk.digitalocean.com/api/resources/agents/subresources/evaluation_metrics/subresources/anthropic/subresources/keys/methods/list An example of the JSON response when successfully listing Anthropic API keys. It includes details about the keys, pagination links, and metadata. ```json { "api_key_infos": [ { "created_at": "2023-01-01T00:00:00Z", "created_by": "12345", "deleted_at": "2023-01-01T00:00:00Z", "name": "example name", "updated_at": "2023-01-01T00:00:00Z", "uuid": "123e4567-e89b-12d3-a456-426614174000" } ], "links": { "pages": { "first": "example string", "last": "example string", "next": "example string", "previous": "example string" } }, "meta": { "page": 123, "pages": 123, "total": 123 } } ``` -------------------------------- ### List Indexing Jobs - 200 Example Response Source: https://gradientai-sdk.digitalocean.com/api/resources/knowledge_bases/subresources/indexing_jobs/methods/list This is an example JSON response for a successful (HTTP 200) request to list indexing jobs. It includes details about the jobs, pagination links, and metadata. ```json { "jobs": [ { "completed_datasources": 123, "created_at": "2023-01-01T00:00:00Z", "data_source_uuids": [ "example string" ], "finished_at": "2023-01-01T00:00:00Z", "knowledge_base_uuid": "123e4567-e89b-12d3-a456-426614174000", "phase": "BATCH_JOB_PHASE_UNKNOWN", "started_at": "2023-01-01T00:00:00Z", "status": "INDEX_JOB_STATUS_UNKNOWN", "tokens": 123, "total_datasources": 123, "total_items_failed": "12345", "total_items_indexed": "12345", "total_items_skipped": "12345", "updated_at": "2023-01-01T00:00:00Z", "uuid": "123e4567-e89b-12d3-a456-426614174000" } ], "links": { "pages": { "first": "example string", "last": "example string", "next": "example string", "previous": "example string" } }, "meta": { "page": 123, "pages": 123, "total": 123 } } ``` -------------------------------- ### Example JSON Response for Listing Regions Source: https://gradientai-sdk.digitalocean.com/api/python/resources/regions/methods/list This is an example of the JSON response received when successfully listing data center regions. It includes metadata about the response, a list of available regions with their features and sizes, and pagination links. ```json { "meta": { "total": 13 }, "regions": [ { "available": true, "features": [ "private_networking", "backups", "ipv6", "metadata", "install_agent", "storage", "image_transfer" ], "name": "New York 3", "sizes": [ "s-1vcpu-1gb", "s-1vcpu-2gb", "s-1vcpu-3gb", "s-2vcpu-2gb", "s-3vcpu-1gb", "s-2vcpu-4gb", "s-4vcpu-8gb", "s-6vcpu-16gb", "s-8vcpu-32gb", "s-12vcpu-48gb", "s-16vcpu-64gb", "s-20vcpu-96gb", "s-24vcpu-128gb", "s-32vcpu-192g" ], "slug": "nyc3" } ], "links": { "pages": { "last": "https://api.digitalocean.com/v2/regions?page=13&per_page=1", "next": "https://api.digitalocean.com/v2/regions?page=2&per_page=1" } } } ``` -------------------------------- ### Configure Agent with Custom Colors and Messages Source: https://gradientai-sdk.digitalocean.com/api/python/resources/agents/subresources/evaluation_metrics/subresources/anthropic/subresources/keys/methods/list_agents This example demonstrates how to configure an agent with primary and secondary colors, along with a custom starting message. It highlights the basic structure for agent customization. ```json { "name": "example name", "primary_color": "example string", "secondary_color": "example string", "starting_message": "example string" } ``` -------------------------------- ### List All Data Center Regions (Python) Source: https://gradientai-sdk.digitalocean.com/api/resources/regions/methods/list Demonstrates how to retrieve a list of all available data center regions using the DigitalOcean API with Python. This example utilizes the 'requests' library to make the GET request. ```python import requests response = requests.get("https://api.digitalocean.com/v2/regions", headers={"Authorization": f"Bearer {DIGITALOCEAN_ACCESS_TOKEN}"}) if response.status_code == 200: data = response.json() print(data) else: print(f"Error: {response.status_code} - {response.text}") ``` -------------------------------- ### List Workspaces using Gradient AI SDK (Python) Source: https://gradientai-sdk.digitalocean.com/api/python/resources/agents/subresources/evaluation_metrics/subresources/workspaces/methods/list This Python code snippet demonstrates how to initialize the Gradient client and list all available workspaces. It then prints the list of workspaces to the console. This function requires the 'gradient' library to be installed and a configured Gradient client. ```Python from gradient import Gradient client = Gradient() workspaces = client.agents.evaluation_metrics.workspaces.list() print(workspaces.workspaces) ``` -------------------------------- ### Retrieve Block Storage Volume (Python) Source: https://gradientai-sdk.digitalocean.com/api/resources/gpu_droplets/subresources/volumes/methods/retrieve Shows how to retrieve details for a DigitalOcean Block Storage Volume using Python. This example utilizes the `requests` library to make the GET request to the API endpoint. ```Python import requests VOLUME_ID = "your_volume_id" DIGITALOCEAN_ACCESS_TOKEN = "your_access_token" url = f"https://api.digitalocean.com/v2/volumes/{VOLUME_ID}" headers = { "Authorization": f"Bearer {DIGITALOCEAN_ACCESS_TOKEN}" } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") print(response.text) ``` -------------------------------- ### Create Workspace using Gradient AI SDK (Python) Source: https://gradientai-sdk.digitalocean.com/api/python/resources/agents/subresources/evaluation_metrics/subresources/workspaces/methods/create Demonstrates how to instantiate the Gradient client and create a new workspace. It then prints the workspace details from the response. This function requires the Gradient SDK to be installed. ```python from gradient import Gradient client = Gradient() workspace = client.agents.evaluation_metrics.workspaces.create() print(workspace.workspace) ``` -------------------------------- ### List OpenAI API Keys using cURL Source: https://gradientai-sdk.digitalocean.com/api/resources/agents/subresources/evaluation_metrics/subresources/openai/subresources/keys/methods/list Send a GET request to the DigitalOcean API endpoint to retrieve a list of all OpenAI API keys. This example uses cURL and requires an authorization token. ```curl curl https://api.digitalocean.com/v2/gen-ai/openai/keys \ -H "Authorization: Bearer $DIGITALOCEAN_ACCESS_TOKEN" ``` -------------------------------- ### Initialize Gradient Client (Python) Source: https://gradientai-sdk.digitalocean.com/api/python/resources/agents/subresources/chat/subresources/completions/methods/create Demonstrates how to initialize the Gradient client using the SDK. This is a prerequisite for making any API calls. ```python from gradient import Gradient ``` -------------------------------- ### GET /v2/droplets/backups/supported_policies Source: https://gradientai-sdk.digitalocean.com/api/python/resources/gpu_droplets/subresources/backups/methods/list_supported_policies Retrieves a list of all supported Droplet backup policies. This endpoint provides information on available backup options, including names, possible days for backups, preferred start times, retention periods, and window lengths. ```APIDOC ## GET /v2/droplets/backups/supported_policies ### Description Retrieves a list of all supported Droplet backup policies. ### Method GET ### Endpoint /v2/droplets/backups/supported_policies ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **supported_policies** (Optional[List[SupportedPolicy]]) - A list of supported backup policies. - **name** (Optional[str]) - The name of the Droplet backup plan. - **possible_days** (Optional[List[str]]) - The day of the week the backup will occur. - **possible_window_starts** (Optional[List[int]]) - An array of integers representing the hours of the day that a backup can start. - **retention_period_days** (Optional[int]) - The number of days that a backup will be kept. - **window_length_hours** (Optional[int]) - The number of hours that a backup window is open. #### Response Example ```json { "supported_policies": [ { "name": "daily", "possible_days": [ "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" ], "possible_window_starts": [ 0, 4, 8, 12, 16, 20 ], "retention_period_days": 7, "window_length_hours": 4 } ] } ``` ``` -------------------------------- ### Create Knowledge Base with Gradient AI SDK (Python) Source: https://gradientai-sdk.digitalocean.com/api/python/resources/knowledge_bases/methods/create This snippet demonstrates how to instantiate the Gradient client and use the `knowledge_bases.create()` method to create a new knowledge base. It assumes the client is authenticated and ready for use. The output prints the knowledge base information returned by the API. ```python from gradient import Gradient client = Gradient() knowledge_base = client.knowledge_bases.create() print(knowledge_base.knowledge_base) ``` -------------------------------- ### List Indexing Jobs - Python Example Source: https://gradientai-sdk.digitalocean.com/api/resources/knowledge_bases/subresources/indexing_jobs/methods/list This Python code snippet demonstrates how to retrieve a list of indexing jobs for a knowledge base from the DigitalOcean API. It uses the requests library to make the GET request and requires an access token. ```python import requests api_url = "https://api.digitalocean.com/v2/gen-ai/indexing_jobs" headers = { "Authorization": "Bearer $DIGITALOCEAN_ACCESS_TOKEN" } response = requests.get(api_url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") print(response.text) ``` -------------------------------- ### Create Firewall using Gradient SDK (Python) Source: https://gradientai-sdk.digitalocean.com/api/python/resources/gpu_droplets/subresources/firewalls/methods/create This snippet demonstrates how to create a new firewall using the Gradient SDK in Python. It initializes the client and calls the firewall creation method, then prints the resulting firewall information. This requires the gradient library to be installed. ```python from gradient import Gradient client = Gradient() firewall = client.gpu_droplets.firewalls.create() print(firewall.firewall) ``` -------------------------------- ### List Supported Droplet Backup Policies (Python) Source: https://gradientai-sdk.digitalocean.com/api/python/resources/gpu_droplets/subresources/backups/methods/list_supported_policies Retrieves a list of all supported Droplet backup policies using the Gradient SDK. This function requires the Gradient client to be initialized and makes a GET request to the appropriate API endpoint. The response includes details about backup plan names, possible backup days, start times, retention periods, and window lengths. ```python from gradient import Gradient client = Gradient() response = client.gpu_droplets.backups.list_supported_policies() print(response.supported_policies) ``` -------------------------------- ### Start Indexing Job Source: https://gradientai-sdk.digitalocean.com/api/resources/knowledge_bases/subresources/indexing_jobs Initiates a new indexing job for a specified knowledge base. ```APIDOC ## POST /v2/gen-ai/indexing_jobs ### Description Starts a new indexing job for a knowledge base. ### Method POST ### Endpoint /v2/gen-ai/indexing_jobs ### Parameters #### Request Body - **knowledge_base_uuid** (string) - Required - The UUID of the knowledge base for which to start the indexing job. - **data_source_uuids** (array of string) - Required - A list of data source UUIDs to include in the indexing job. ### Request Example ```json { "knowledge_base_uuid": "string", "data_source_uuids": [ "string" ] } ``` ### Response #### Success Response (200) - **uuid** (string) - The UUID of the newly created indexing job. - **knowledge_base_uuid** (string) - The UUID of the knowledge base. - **data_source_uuids** (array of string) - The UUIDs of the data sources included in the job. - **created_at** (string) - The timestamp when the job was created. - **status** (string) - The initial status of the indexing job. #### Response Example ```json { "uuid": "string", "knowledge_base_uuid": "string", "data_source_uuids": [ "string" ], "created_at": "string", "status": "string" } ``` ``` -------------------------------- ### GET /v2/droplets/{droplet_id}/backups Source: https://gradientai-sdk.digitalocean.com/api/python/resources/gpu_droplets/subresources/backups/methods/list To retrieve any backups associated with a Droplet, send a GET request to `/v2/droplets/$DROPLET_ID/backups`. You will get back a JSON object that has a `backups` key. This will be set to an array of backup objects, each of which contain the standard Droplet backup attributes. ```APIDOC ## GET /v2/droplets/{droplet_id}/backups ### Description Retrieves a list of backups associated with a specific Droplet. ### Method GET ### Endpoint `/v2/droplets/{droplet_id}/backups` ### Parameters #### Path Parameters - **droplet_id** (int) - Required - The unique identifier for the Droplet. #### Query Parameters - **page** (int) - Optional - Which 'page' of paginated results to return. Minimum: 1 - **per_page** (int) - Optional - Number of items returned per page. Minimum: 1, Maximum: 200 ### Request Example ```python from gradient import Gradient client = Gradient() backups = client.gpu_droplets.backups.list( droplet_id=3164444, ) print(backups.meta) ``` ### Response #### Success Response (200) - **meta** (MetaProperties) - Information about the response itself. - **backups** (List[Backup]) - An array of backup objects. - **id** (int) - The unique identifier for the snapshot or backup. - **created_at** (datetime) - A time value given in ISO8601 combined date and time format that represents when the snapshot was created. - **min_disk_size** (int) - The minimum size in GB required for a volume or Droplet to use this snapshot. - **name** (str) - A human-readable name for the snapshot. - **regions** (List[str]) - An array of the regions that the snapshot is available in. - **size_gigabytes** (float) - The billable size of the snapshot in gigabytes. - **type** (Literal["snapshot", "backup"]) - Describes the kind of image. It may be one of `snapshot` or `backup`. - **links** (PageLinks) - Links for pagination. #### Response Example ```json { "meta": { "total": 1 }, "backups": [ { "id": 6372321, "created_at": "2020-07-28T16:47:44Z", "min_disk_size": 25, "name": "web-01-1595954862243", "regions": [ "nyc3", "sfo3" ], "size_gigabytes": 2.34, "type": "snapshot" } ], "links": { "pages": { "last": "https://api.digitalocean.com/v2/images?page=2", "next": "https://api.digitalocean.com/v2/images?page=2" } } } ``` ``` -------------------------------- ### GET /v2/gen-ai/agents/{uuid} Source: https://gradientai-sdk.digitalocean.com/api/python/resources/agents/methods/retrieve Retrieves details of an existing agent by its UUID. This is a GET request to the specified endpoint. ```APIDOC ## GET /v2/gen-ai/agents/{uuid} ### Description Retrieves details of an existing agent by its unique identifier. ### Method GET ### Endpoint /v2/gen-ai/agents/{uuid} ### Parameters #### Path Parameters - **uuid** (str) - Required - The unique identifier of the agent to retrieve. ### Request Example (No request body for this GET request) ### Response #### Success Response (200) - **AgentRetrieveResponse** (object) - A JSON object containing the agent's details. Structure is detailed in the SDK's AgentRetrieveResponse model. #### Response Example ```json { "id": "agent-uuid-123", "name": "Example Agent", "description": "This is an example agent.", "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:00:00Z" } ``` ```