Skip to main content

MeshyToolkit

A class representing a toolkit for 3D model generation using Meshy. This class provides methods that handle text/image to 3D model generation using Meshy. Call the generate_3d_model_complete method to generate a refined 3D model. Ref: https://docs.meshy.ai/api-text-to-3d-beta#create-a-text-to-3d-preview-task

init

Initializes the MeshyToolkit with the API key from the environment.

generate_3d_preview

Generates a 3D preview using the Meshy API. Parameters:
  • prompt (str): Description of the object.
  • art_style (str): Art style for the 3D model.
  • negative_prompt (str): What the model should not look like.
Returns: Dict[str, Any]: The result property of the response contains the task id of the newly created Text to 3D task.

refine_3d_model

Refines a 3D model using the Meshy API. Parameters:
  • preview_task_id (str): The task ID of the preview to refine.
Returns: Dict[str, Any]: The response from the Meshy API.

get_task_status

Retrieves the status or result of a specific 3D model generation task using the Meshy API. Parameters:
  • task_id (str): The ID of the task to retrieve.
Returns: Dict[str, Any]: The response from the Meshy API.

wait_for_task_completion

Waits for a task to complete by polling its status. Parameters:
  • task_id (str): The ID of the task to monitor.
  • polling_interval (int): Seconds to wait between status checks. (default: :obj:10)
  • timeout (int): Maximum seconds to wait before timing out. (default: :obj:3600)
Returns: Dict[str, Any]: Final response from the API when task completes.

generate_3d_model_complete

Generates a complete 3D model by handling preview and refinement stages Parameters:
  • prompt (str): Description of the object.
  • art_style (str): Art style for the 3D model.
  • negative_prompt (str): What the model should not look like.
Returns: Dict[str, Any]: The final refined 3D model response.

get_tools

Returns: List[FunctionTool]: A list of FunctionTool objects representing the functions in the toolkit.