🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
Auto-update documentation after merge [skip ci]
camel-docs-bot9f90e57ae903
diff --git a/docs/mintlify/docs.json b/docs/mintlify/docs.jsonindex dc2c48dc7..075062d60 100644--- a/docs/mintlify/docs.json+++ b/docs/mintlify/docs.json@@ -502,6 +502,7 @@"reference/camel.toolkits.google_scholar_toolkit","reference/camel.toolkits.human_toolkit","reference/camel.toolkits.image_analysis_toolkit",+ "reference/camel.toolkits.image_generation_toolkit","reference/camel.toolkits.jina_reranker_toolkit","reference/camel.toolkits.klavis_toolkit","reference/camel.toolkits.linkedin_toolkit",diff --git a/docs/mintlify/reference/camel.toolkits.image_generation_toolkit.mdx b/docs/mintlify/reference/camel.toolkits.image_generation_toolkit.mdxnew file mode 100644index 000000000..7d271199f--- /dev/null+++ b/docs/mintlify/reference/camel.toolkits.image_generation_toolkit.mdx@@ -0,0 +1,186 @@+<a id="camel.toolkits.image_generation_toolkit"></a>++<a id="camel.toolkits.image_generation_toolkit.ImageGenToolkit"></a>++## ImageGenToolkit++```python+class ImageGenToolkit(BaseToolkit):+```++A class toolkit for image generation using Grok and OpenAI models.++<a id="camel.toolkits.image_generation_toolkit.ImageGenToolkit.__init__"></a>++### __init__++```python+def __init__(+ self,+ model: Optional[Literal['gpt-image-1', 'dall-e-3', 'dall-e-2', 'grok-2-image', 'grok-2-image-latest', 'grok-2-image-1212']] = 'dall-e-3',+ timeout: Optional[float] = None,+ api_key: Optional[str] = None,+ url: Optional[str] = None,+ size: Optional[Literal['256x256', '512x512', '1024x1024', '1536x1024', '1024x1536', '1792x1024', '1024x1792', 'auto']] = '1024x1024',+ quality: Optional[Literal['auto', 'low', 'medium', 'high', 'standard', 'hd']] = 'standard',+ response_format: Optional[Literal['url', 'b64_json']] = 'b64_json',+ background: Optional[Literal['transparent', 'opaque', 'auto']] = 'auto',+ style: Optional[Literal['vivid', 'natural']] = None,+ working_directory: Optional[str] = 'image_save'+):+```++Initializes a new instance of the ImageGenToolkit class.++**Parameters:**++- **api_key** (Optional[str]): The API key for authenticating with the image model service. (default: :obj:`None`)+- **url** (Optional[str]): The url to the image model service. (default: :obj:`None`)+- **model** (Optional[str]): The model to use. (default: :obj:`"dall-e-3"`)+- **timeout** (Optional[float]): The timeout value for API requests in seconds. If None, no timeout is applied. (default: :obj:`None`) size (Optional[Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "1792x1024", "1024x1792", "auto"]]): The size of the image to generate. (default: :obj:`"1024x1024"`) quality (Optional[Literal["auto", "low", "medium", "high", "standard", "hd"]]):The quality of the image to generate. Different models support different values. (default: :obj:`"standard"`)+- **response_format** (`Optional[Literal["url", "b64_json"]]`): The format of the response.(default: :obj:`"b64_json"`)+- **background** (`Optional[Literal["transparent", "opaque", "auto"]]`): The background of the image.(default: :obj:`"auto"`)+- **style** (`Optional[Literal["vivid", "natural"]]`): The style of the image.(default: :obj:`None`)+- **working_directory** (Optional[str]): The path to save the generated image.(default: :obj:`"image_save"`)++<a id="camel.toolkits.image_generation_toolkit.ImageGenToolkit.base64_to_image"></a>++### base64_to_image++```python+def base64_to_image(self, base64_string: str):+```++Converts a base64 encoded string into a PIL Image object.++**Parameters:**++- **base64_string** (str): The base64 encoded string of the image.++**Returns:**++ Optional[Image.Image]: The PIL Image object or None if conversion+fails.++<a id="camel.toolkits.image_generation_toolkit.ImageGenToolkit._build_base_params"></a>++### _build_base_params++```python+def _build_base_params(self, prompt: str, n: Optional[int] = None):+```++Build base parameters dict for Image Model API calls.++**Parameters:**++- **prompt** (str): The text prompt for the image operation.+- **n** (Optional[int]): The number of images to generate.++**Returns:**++ dict: Parameters dictionary with non-None values.++<a id="camel.toolkits.image_generation_toolkit.ImageGenToolkit._handle_api_response"></a>++### _handle_api_response++```python+def _handle_api_response(+ self,+ response,+ image_name: Union[str, List[str]],+ operation: str+):+```++Handle API response from image operations.++**Parameters:**++- **response**: The response object from image model API.+- **image_name** (Union[str, List[str]]): Name(s) for the saved image file(s). If str, the same name is used for all images (will cause error for multiple images). If list, must have exactly the same length as the number of images generated.+- **operation** (str): Operation type for success message ("generated").++**Returns:**++ str: Success message with image path/URL or error message.++<a id="camel.toolkits.image_generation_toolkit.ImageGenToolkit.generate_image"></a>++### generate_image++```python+def generate_image(+ self,+ prompt: str,+ image_name: Union[str, List[str]] = 'image.png',+ n: int = 1+):+```++Generate an image using image models.+The generated image will be saved locally (for `__INLINE_CODE_0__` response+formats) or an image URL will be returned (for `__INLINE_CODE_1__` response+formats).++**Parameters:**++- **prompt** (str): The text prompt to generate the image.+- **image_name** (Union[str, List[str]]): The name(s) of the image(s) to save. The image name must end with `.png`. If str: same name used for all images (causes error if n > 1). If list: must match the number of images being generated (n parameter). (default: :obj:`"image.png"`)+- **n** (int): The number of images to generate. (default: :obj:`1`) (default: 1)++**Returns:**++ str: the content of the model response or format of the response.++<a id="camel.toolkits.image_generation_toolkit.ImageGenToolkit.get_grok_credentials"></a>++### get_grok_credentials++```python+def get_grok_credentials(self, url, api_key):+```++Get API credentials for the specified Grok model.++**Parameters:**++- **url** (str): The base URL for the Grok API.+- **api_key** (str): The API key for the Grok API.++**Returns:**++ tuple: (api_key, base_url)++<a id="camel.toolkits.image_generation_toolkit.ImageGenToolkit.get_openai_credentials"></a>++### get_openai_credentials++```python+def get_openai_credentials(self, url, api_key):+```++Get API credentials for the specified OpenAI model.++**Parameters:**++- **url** (str): The base URL for the OpenAI API.+- **api_key** (str): The API key for the OpenAI API.++**Returns:**++ Tuple[str, str | None]: (api_key, base_url)++<a id="camel.toolkits.image_generation_toolkit.ImageGenToolkit.get_tools"></a>++### get_tools++```python+def get_tools(self):+```++**Returns:**++ List[FunctionTool]: A list of FunctionTool objects representing the+functions in the toolkit.