From 326547ad2aff49c1dffccac2d094c93c38c83e65 Mon Sep 17 00:00:00 2001 From: hwzhuhao <923196325@qq.com> Date: Fri, 11 Oct 2024 12:13:47 +0800 Subject: [PATCH] feat: add fal tool for image generation --- .../provider/builtin/fal/_assets/icon.svg | 7 + api/core/tools/provider/builtin/fal/fal.py | 17 +++ api/core/tools/provider/builtin/fal/fal.yaml | 21 +++ .../provider/builtin/fal/tools/auraflow.py | 35 +++++ .../provider/builtin/fal/tools/auraflow.yaml | 78 ++++++++++ .../tools/provider/builtin/fal/tools/flux.py | 40 +++++ .../provider/builtin/fal/tools/flux.yaml | 132 +++++++++++++++++ .../provider/builtin/fal/tools/kolors.py | 38 +++++ .../provider/builtin/fal/tools/kolors.yaml | 124 ++++++++++++++++ .../builtin/fal/tools/stable_diffusion.py | 45 ++++++ .../builtin/fal/tools/stable_diffusion.yaml | 139 ++++++++++++++++++ api/poetry.lock | 84 ++++++++--- api/pyproject.toml | 1 + 13 files changed, 738 insertions(+), 23 deletions(-) create mode 100644 api/core/tools/provider/builtin/fal/_assets/icon.svg create mode 100644 api/core/tools/provider/builtin/fal/fal.py create mode 100644 api/core/tools/provider/builtin/fal/fal.yaml create mode 100644 api/core/tools/provider/builtin/fal/tools/auraflow.py create mode 100644 api/core/tools/provider/builtin/fal/tools/auraflow.yaml create mode 100644 api/core/tools/provider/builtin/fal/tools/flux.py create mode 100644 api/core/tools/provider/builtin/fal/tools/flux.yaml create mode 100644 api/core/tools/provider/builtin/fal/tools/kolors.py create mode 100644 api/core/tools/provider/builtin/fal/tools/kolors.yaml create mode 100644 api/core/tools/provider/builtin/fal/tools/stable_diffusion.py create mode 100644 api/core/tools/provider/builtin/fal/tools/stable_diffusion.yaml diff --git a/api/core/tools/provider/builtin/fal/_assets/icon.svg b/api/core/tools/provider/builtin/fal/_assets/icon.svg new file mode 100644 index 0000000000000..11117c0c10728 --- /dev/null +++ b/api/core/tools/provider/builtin/fal/_assets/icon.svg @@ -0,0 +1,7 @@ + + + fal + + + + \ No newline at end of file diff --git a/api/core/tools/provider/builtin/fal/fal.py b/api/core/tools/provider/builtin/fal/fal.py new file mode 100644 index 0000000000000..c49a750ff735c --- /dev/null +++ b/api/core/tools/provider/builtin/fal/fal.py @@ -0,0 +1,17 @@ +import requests + +from core.tools.errors import ToolProviderCredentialValidationError +from core.tools.provider.builtin_tool_provider import BuiltinToolProviderController + + +class FalProvider(BuiltinToolProviderController): + def _validate_credentials(self, credentials: dict) -> None: + url = "https://queue.fal.run/fal-ai/flux/schnell" + headers = { + "Content-Type": "application/json", + "Authorization": f"Key {credentials.get('fal_api_key')}", + } + data = {"prompt": "cute girl, blue eyes, white hair, anime style."} + response = requests.post(url, headers=headers, data=data) + if response.status_code != 200: + raise ToolProviderCredentialValidationError("Fal API key is invalid") diff --git a/api/core/tools/provider/builtin/fal/fal.yaml b/api/core/tools/provider/builtin/fal/fal.yaml new file mode 100644 index 0000000000000..6040f09daa922 --- /dev/null +++ b/api/core/tools/provider/builtin/fal/fal.yaml @@ -0,0 +1,21 @@ +identity: + author: zhuhao + name: fal + label: + en_US: Fal + zh_CN: Fal + description: + en_US: The image generation API provided by fal.ai includes Flux, AuraFlow, Stable Diffusion and Kolors models. + zh_CN: Fal提供的图片生成API, 包含Flux,AuraFlow,Stable Diffusion和Kolors模型。 + icon: icon.svg + tags: + - image +credentials_for_provider: + fal_api_key: + type: secret-input + required: true + label: + en_US: Fal API Key + placeholder: + en_US: Please input your Fal API key + url: https://fal.ai/dashboard/keys diff --git a/api/core/tools/provider/builtin/fal/tools/auraflow.py b/api/core/tools/provider/builtin/fal/tools/auraflow.py new file mode 100644 index 0000000000000..7bcba4f54ff3b --- /dev/null +++ b/api/core/tools/provider/builtin/fal/tools/auraflow.py @@ -0,0 +1,35 @@ +from typing import Any, Union + +import fal_client + +from core.tools.entities.tool_entities import ToolInvokeMessage +from core.tools.tool.builtin_tool import BuiltinTool + + +class AuraFlowTool(BuiltinTool): + """ + A tool for generating image via Fal.ai AuraFlow model + """ + + def _invoke( + self, user_id: str, tool_parameters: dict[str, Any] + ) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]: + api_key = self.runtime.credentials.get("fal_api_key", "") + if not api_key: + return self.create_text_message("Please input fal api key") + client = fal_client.SyncClient(key=api_key) + payload = { + "prompt": tool_parameters.get("prompt"), + "num_images": tool_parameters.get("num_images", 1), + "seed": tool_parameters.get("seed"), + "guidance_scale": tool_parameters.get("guidance_scale", 3.5), + "num_inference_steps": tool_parameters.get("num_inference_steps", 50), + "expand_prompt": tool_parameters.get("expand_prompt", True), + } + handler = client.submit("fal-ai/aura-flow", arguments=payload) + request_id = handler.request_id + res = client.result("fal-ai/aura-flow", request_id) + result = [] + for image in res.get("images", []): + result.append(self.create_image_message(image=image.get("url"), save_as=self.VariableKey.IMAGE.value)) + return result diff --git a/api/core/tools/provider/builtin/fal/tools/auraflow.yaml b/api/core/tools/provider/builtin/fal/tools/auraflow.yaml new file mode 100644 index 0000000000000..4a62c9cc5091a --- /dev/null +++ b/api/core/tools/provider/builtin/fal/tools/auraflow.yaml @@ -0,0 +1,78 @@ +identity: + name: auraflow + author: zhuhao + label: + en_US: AuraFlow + icon: icon.svg +description: + human: + en_US: Generate image via Fal.ai AuraFlow model. + llm: This tool is used to generate image from prompt via Fal.ai AuraFlow model. +parameters: + - name: prompt + type: string + required: true + label: + en_US: prompt + zh_Hans: 提示词 + human_description: + en_US: The text prompt used to generate the image. + zh_Hans: 建议用英文的生成图片提示词以获得更好的生成效果。 + llm_description: this prompt text will be used to generate image. + form: llm + - name: num_inference_steps + type: number + required: true + default: 28 + min: 1 + max: 100 + label: + en_US: Num Inference Steps + zh_Hans: 生成图片的步数 + form: form + human_description: + en_US: The number of inference steps to perform. More steps produce higher quality but take longer. + zh_Hans: 执行的推理步骤数量。更多的步骤可以产生更高质量的结果,但需要更长的时间。 + - name: seed + type: number + min: 0 + max: 9999999999 + label: + en_US: Seed + zh_Hans: 种子 + human_description: + en_US: The same seed and prompt can produce similar images. + zh_Hans: 相同的种子和提示可以产生相似的图像。 + form: form + - name: guidance_scale + type: number + required: false + default: 3.5 + label: + en_US: Guidance Scale + zh_Hans: 引导缩放比例 + form: form + human_description: + en_US: The Guidance scale is a measure of how close you want the model to stick to your prompt when looking for a related image to you. + zh_Hans: 无分类器引导比例是衡量在寻找相关图像展示时最贴近提示的一个尺度. + - name: num_images + type: number + default: 1 + label: + en_US: Image Number + zh_Hans: 图像数量 + human_description: + en_US: The number of images to generate + zh_Hans: 生成图像的数量 + form: form + - name: expand_prompt + type: boolean + default: true + label: + en_US: prompt expansion + zh_Hans: 是否进行提示词扩展 + human_description: + en_US: Whether to perform prompt expansion + zh_Hans: 是否进行提示词扩展 + llm_description: Perform prompt expansion if true. + form: llm diff --git a/api/core/tools/provider/builtin/fal/tools/flux.py b/api/core/tools/provider/builtin/fal/tools/flux.py new file mode 100644 index 0000000000000..e4b8cce312b25 --- /dev/null +++ b/api/core/tools/provider/builtin/fal/tools/flux.py @@ -0,0 +1,40 @@ +from typing import Any, Union + +import fal_client + +from core.tools.entities.tool_entities import ToolInvokeMessage +from core.tools.tool.builtin_tool import BuiltinTool + +FLUX_MODEL = {"schnell": "fal-ai/flux/schnell", "dev": "fal-ai/flux/dev", "pro": ""} + + +class FluxTool(BuiltinTool): + """ + A tool for generating image via Fal.ai Flux model + """ + + def _invoke( + self, user_id: str, tool_parameters: dict[str, Any] + ) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]: + api_key = self.runtime.credentials.get("fal_api_key", "") + if not api_key: + return self.create_text_message("Please input fal api key") + client = fal_client.SyncClient(key=api_key) + model = tool_parameters.get("model", "schnell") + model_name = FLUX_MODEL.get(model) + payload = { + "prompt": tool_parameters.get("prompt"), + "image_size": tool_parameters.get("image_size", "landscape_4_3"), + "num_images": tool_parameters.get("num_images", 1), + "seed": tool_parameters.get("seed"), + "num_inference_steps": tool_parameters.get("num_inference_steps", 4), + "sync_mode": tool_parameters.get("sync_mode", True), + "enable_safety_checker": tool_parameters.get("enable_safety_checker", True), + } + handler = client.submit(model_name, arguments=payload) + request_id = handler.request_id + res = client.result(model_name, request_id) + result = [] + for image in res.get("images", []): + result.append(self.create_image_message(image=image.get("url"), save_as=self.VariableKey.IMAGE.value)) + return result diff --git a/api/core/tools/provider/builtin/fal/tools/flux.yaml b/api/core/tools/provider/builtin/fal/tools/flux.yaml new file mode 100644 index 0000000000000..580853d0559e9 --- /dev/null +++ b/api/core/tools/provider/builtin/fal/tools/flux.yaml @@ -0,0 +1,132 @@ +identity: + name: flux + author: zhuhao + label: + en_US: Flux + icon: icon.svg +description: + human: + en_US: Generate image via Fal.ai flux model. + llm: This tool is used to generate image from prompt via Fal.ai flux model. +parameters: + - name: model + type: select + required: true + options: + - value: schnell + label: + en_US: Flux.1-schnell + - value: dev + label: + en_US: Flux.1-dev + - value: pro + label: + en_US: Flux.1-pro + default: schnell + label: + en_US: Choose Image Model + zh_Hans: 选择生成图片的模型 + form: form + - name: prompt + type: string + required: true + label: + en_US: prompt + zh_Hans: 提示词 + human_description: + en_US: The text prompt used to generate the image. + zh_Hans: 建议用英文的生成图片提示词以获得更好的生成效果。 + llm_description: this prompt text will be used to generate image. + form: llm + - name: image_size + type: select + required: true + options: + - value: square_hd + label: + en_US: square_hd + - value: square + label: + en_US: square + - value: portrait_4_3 + label: + en_US: portrait_4_3 + - value: portrait_16_9 + label: + en_US: portrait_16_9 + - value: landscape_4_3 + label: + en_US: landscape_4_3 + - value: landscape_16_9 + label: + en_US: landscape_16_9 + default: landscape_4_3 + label: + en_US: The size of the generated image + zh_Hans: 选择生成的图片大小 + form: form + - name: num_inference_steps + type: number + required: true + default: 28 + min: 1 + max: 100 + label: + en_US: Num Inference Steps + zh_Hans: 生成图片的步数 + form: form + human_description: + en_US: The number of inference steps to perform. More steps produce higher quality but take longer. + zh_Hans: 执行的推理步骤数量。更多的步骤可以产生更高质量的结果,但需要更长的时间。 + - name: seed + type: number + min: 0 + max: 9999999999 + label: + en_US: Seed + zh_Hans: 种子 + human_description: + en_US: The same seed and prompt can produce similar images. + zh_Hans: 相同的种子和提示可以产生相似的图像。 + form: form + - name: guidance_scale + type: number + required: false + default: 3.5 + label: + en_US: Guidance Scale + zh_Hans: 引导缩放比例 + form: form + human_description: + en_US: The Guidance scale is a measure of how close you want the model to stick to your prompt when looking for a related image to you. + zh_Hans: 无分类器引导比例是衡量在寻找相关图像展示时最贴近提示的一个尺度. + - name: num_images + type: number + default: 1 + label: + en_US: Image Number + zh_Hans: 图像数量 + human_description: + en_US: The number of images to generate + zh_Hans: 生成图像的数量 + form: form + - name: sync_mode + type: boolean + default: false + label: + en_US: Sync Mode + zh_Hans: 同步模式 + human_description: + en_US: The function will wait for the image to be generated and uploaded before returning the response if true + zh_Hans: 为真时该函数将在返回响应之前等待图像生成并上传. + form: form + - name: enable_safety_checker + type: boolean + default: true + label: + en_US: Enable Safety Checker + zh_Hans: 开启安全检测 + human_description: + en_US: The safety checker will be enabled if true + zh_Hans: 为真时开启安全检测. + form: form diff --git a/api/core/tools/provider/builtin/fal/tools/kolors.py b/api/core/tools/provider/builtin/fal/tools/kolors.py new file mode 100644 index 0000000000000..20c5474e1483a --- /dev/null +++ b/api/core/tools/provider/builtin/fal/tools/kolors.py @@ -0,0 +1,38 @@ +from typing import Any, Union + +import fal_client + +from core.tools.entities.tool_entities import ToolInvokeMessage +from core.tools.tool.builtin_tool import BuiltinTool + + +class AuraFlowTool(BuiltinTool): + """ + A tool for generating image via Fal.ai AuraFlow model + """ + + def _invoke( + self, user_id: str, tool_parameters: dict[str, Any] + ) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]: + api_key = self.runtime.credentials.get("fal_api_key", "") + if not api_key: + return self.create_text_message("Please input fal api key") + client = fal_client.SyncClient(key=api_key) + payload = { + "prompt": tool_parameters.get("prompt"), + "negative_prompt": tool_parameters.get("negative_prompt", ""), + "image_size": tool_parameters.get("image_size", "square_hd"), + "num_images": tool_parameters.get("num_images", 1), + "seed": tool_parameters.get("seed"), + "guidance_scale": tool_parameters.get("guidance_scale", 5), + "num_inference_steps": tool_parameters.get("num_inference_steps", 50), + "sync_mode": tool_parameters.get("sync_mode", True), + "enable_safety_checker": tool_parameters.get("enable_safety_checker", True), + } + handler = client.submit("fal-ai/kolors", arguments=payload) + request_id = handler.request_id + res = client.result("fal-ai/kolors", request_id) + result = [] + for image in res.get("images", []): + result.append(self.create_image_message(image=image.get("url"), save_as=self.VariableKey.IMAGE.value)) + return result diff --git a/api/core/tools/provider/builtin/fal/tools/kolors.yaml b/api/core/tools/provider/builtin/fal/tools/kolors.yaml new file mode 100644 index 0000000000000..126eca5fa7584 --- /dev/null +++ b/api/core/tools/provider/builtin/fal/tools/kolors.yaml @@ -0,0 +1,124 @@ +identity: + name: kolors + author: zhuhao + label: + en_US: Kolors + icon: icon.svg +description: + human: + en_US: Generate image via Fal.ai Kolors model. + llm: This tool is used to generate image from prompt via Fal.ai Kolors model. +parameters: + - name: prompt + type: string + required: true + label: + en_US: prompt + zh_Hans: 提示词 + human_description: + en_US: The text prompt used to generate the image. + zh_Hans: 建议用英文的生成图片提示词以获得更好的生成效果。 + llm_description: this prompt text will be used to generate image. + form: llm + - name: negative_prompt + type: string + label: + en_US: negative prompt + zh_Hans: 负面提示词 + human_description: + en_US: Describe what you don't want included in the image. + zh_Hans: 描述您不希望包含在图片中的内容。 + llm_description: Describe what you don't want included in the image. + form: llm + - name: image_size + type: select + required: true + options: + - value: square_hd + label: + en_US: square_hd + - value: square + label: + en_US: square + - value: portrait_4_3 + label: + en_US: portrait_4_3 + - value: portrait_16_9 + label: + en_US: portrait_16_9 + - value: landscape_4_3 + label: + en_US: landscape_4_3 + - value: landscape_16_9 + label: + en_US: landscape_16_9 + default: square_hd + label: + en_US: The size of the generated image + zh_Hans: 选择生成的图片大小 + form: form + - name: num_inference_steps + type: number + required: true + default: 50 + min: 1 + max: 100 + label: + en_US: Num Inference Steps + zh_Hans: 生成图片的步数 + form: form + human_description: + en_US: The number of inference steps to perform. More steps produce higher quality but take longer. + zh_Hans: 执行的推理步骤数量。更多的步骤可以产生更高质量的结果,但需要更长的时间。 + - name: seed + type: number + min: 0 + max: 9999999999 + label: + en_US: Seed + zh_Hans: 种子 + human_description: + en_US: The same seed and prompt can produce similar images. + zh_Hans: 相同的种子和提示可以产生相似的图像。 + form: form + - name: guidance_scale + type: number + required: false + default: 5 + label: + en_US: Guidance Scale + zh_Hans: 引导缩放比例 + form: form + human_description: + en_US: The Guidance scale is a measure of how close you want the model to stick to your prompt when looking for a related image to you. + zh_Hans: 无分类器引导比例是衡量在寻找相关图像展示时最贴近提示的一个尺度. + - name: num_images + type: number + default: 1 + label: + en_US: Image Number + zh_Hans: 图像数量 + human_description: + en_US: The number of images to generate + zh_Hans: 生成图像的数量 + form: form + - name: sync_mode + type: boolean + default: false + label: + en_US: Sync Mode + zh_Hans: 同步模式 + human_description: + en_US: The function will wait for the image to be generated and uploaded before returning the response if true + zh_Hans: 为真时该函数将在返回响应之前等待图像生成并上传. + form: form + - name: enable_safety_checker + type: boolean + default: true + label: + en_US: Enable Safety Checker + zh_Hans: 开启安全检测 + human_description: + en_US: The safety checker will be enabled if true + zh_Hans: 为真时开启安全检测. + form: form diff --git a/api/core/tools/provider/builtin/fal/tools/stable_diffusion.py b/api/core/tools/provider/builtin/fal/tools/stable_diffusion.py new file mode 100644 index 0000000000000..a1be4c3a278f4 --- /dev/null +++ b/api/core/tools/provider/builtin/fal/tools/stable_diffusion.py @@ -0,0 +1,45 @@ +from typing import Any, Union + +import fal_client + +from core.tools.entities.tool_entities import ToolInvokeMessage +from core.tools.tool.builtin_tool import BuiltinTool + +SD_MODEL = { + "sd_3": "fal-ai/stable-diffusion-v3-medium", + "sd_xl": "fal-ai/fast-sdxl", +} + + +class StableDiffusionTool(BuiltinTool): + """ + A tool for generating image via Fal.ai Stable Diffusion model + """ + + def _invoke( + self, user_id: str, tool_parameters: dict[str, Any] + ) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]: + api_key = self.runtime.credentials.get("fal_api_key", "") + if not api_key: + return self.create_text_message("Please input fal api key") + client = fal_client.SyncClient(key=api_key) + model = tool_parameters.get("model", "schnell") + model_name = SD_MODEL.get(model) + payload = { + "prompt": tool_parameters.get("prompt"), + "negative_prompt": tool_parameters.get("negative_prompt", ""), + "image_size": tool_parameters.get("image_size", "square_hd"), + "num_images": tool_parameters.get("num_images", 1), + "seed": tool_parameters.get("seed"), + "num_inference_steps": tool_parameters.get("num_inference_steps", 28), + "guidance_scale": tool_parameters.get("guidance_scale", 5), + "sync_mode": tool_parameters.get("sync_mode", True), + "enable_safety_checker": tool_parameters.get("enable_safety_checker", True), + } + handler = client.submit(model_name, arguments=payload) + request_id = handler.request_id + res = client.result(model_name, request_id) + result = [] + for image in res.get("images", []): + result.append(self.create_image_message(image=image.get("url"), save_as=self.VariableKey.IMAGE.value)) + return result diff --git a/api/core/tools/provider/builtin/fal/tools/stable_diffusion.yaml b/api/core/tools/provider/builtin/fal/tools/stable_diffusion.yaml new file mode 100644 index 0000000000000..096c0f97435de --- /dev/null +++ b/api/core/tools/provider/builtin/fal/tools/stable_diffusion.yaml @@ -0,0 +1,139 @@ +identity: + name: stable_diffusion + author: zhuhao + label: + en_US: Stable Diffusion + icon: icon.svg +description: + human: + en_US: Generate image via Fal.ai Stable Diffusion model. + llm: This tool is used to generate image from prompt via Fal.ai Stable Diffusion model. +parameters: + - name: model + type: select + required: true + options: + - value: sd_3 + label: + en_US: Stable Diffusion 3 + - value: sd_xl + label: + en_US: Stable Diffusion XL + default: sd_3 + label: + en_US: Choose Image Model + zh_Hans: 选择生成图片的模型 + form: form + - name: prompt + type: string + required: true + label: + en_US: prompt + zh_Hans: 提示词 + human_description: + en_US: The text prompt used to generate the image. + zh_Hans: 建议用英文的生成图片提示词以获得更好的生成效果。 + llm_description: this prompt text will be used to generate image. + form: llm + - name: negative_prompt + type: string + label: + en_US: negative prompt + zh_Hans: 负面提示词 + human_description: + en_US: Describe what you don't want included in the image. + zh_Hans: 描述您不希望包含在图片中的内容。 + llm_description: Describe what you don't want included in the image. + form: llm + - name: image_size + type: select + required: true + options: + - value: square_hd + label: + en_US: square_hd + - value: square + label: + en_US: square + - value: portrait_4_3 + label: + en_US: portrait_4_3 + - value: portrait_16_9 + label: + en_US: portrait_16_9 + - value: landscape_4_3 + label: + en_US: landscape_4_3 + - value: landscape_16_9 + label: + en_US: landscape_16_9 + default: square_hd + label: + en_US: The size of the generated image + zh_Hans: 选择生成的图片大小 + form: form + - name: num_inference_steps + type: number + required: true + default: 28 + min: 1 + max: 100 + label: + en_US: Num Inference Steps + zh_Hans: 生成图片的步数 + form: form + human_description: + en_US: The number of inference steps to perform. More steps produce higher quality but take longer. + zh_Hans: 执行的推理步骤数量。更多的步骤可以产生更高质量的结果,但需要更长的时间。 + - name: seed + type: number + min: 0 + max: 9999999999 + label: + en_US: Seed + zh_Hans: 种子 + human_description: + en_US: The same seed and prompt can produce similar images. + zh_Hans: 相同的种子和提示可以产生相似的图像。 + form: form + - name: guidance_scale + type: number + required: false + default: 5 + label: + en_US: Guidance Scale + zh_Hans: 引导缩放比例 + form: form + human_description: + en_US: The Guidance scale is a measure of how close you want the model to stick to your prompt when looking for a related image to you. + zh_Hans: 无分类器引导比例是衡量在寻找相关图像展示时最贴近提示的一个尺度. + - name: num_images + type: number + default: 1 + label: + en_US: Image Number + zh_Hans: 图像数量 + human_description: + en_US: The number of images to generate + zh_Hans: 生成图像的数量 + form: form + - name: sync_mode + type: boolean + default: false + label: + en_US: Sync Mode + zh_Hans: 同步模式 + human_description: + en_US: The function will wait for the image to be generated and uploaded before returning the response if true + zh_Hans: 为真时该函数将在返回响应之前等待图像生成并上传. + form: form + - name: enable_safety_checker + type: boolean + default: true + label: + en_US: Enable Safety Checker + zh_Hans: 开启安全检测 + human_description: + en_US: The safety checker will be enabled if true + zh_Hans: 为真时开启安全检测. + form: form diff --git a/api/poetry.lock b/api/poetry.lock index b7421ca566929..62ba7a385282d 100644 --- a/api/poetry.lock +++ b/api/poetry.lock @@ -732,7 +732,7 @@ name = "bce-python-sdk" version = "0.9.23" description = "BCE SDK for python" optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,<4,>=2.7" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, <4" files = [ {file = "bce_python_sdk-0.9.23-py3-none-any.whl", hash = "sha256:8debe21a040e00060f6044877d594765ed7b18bc765c6bf16b878bca864140a3"}, {file = "bce_python_sdk-0.9.23.tar.gz", hash = "sha256:19739fed5cd0725356fc5ffa2acbdd8fb23f2a81edb91db21a03174551d0cf41"}, @@ -844,13 +844,13 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] [[package]] name = "botocore" -version = "1.35.37" +version = "1.35.38" description = "Low-level, data-driven core of boto 3." optional = false -python-versions = ">=3.8" +python-versions = ">= 3.8" files = [ - {file = "botocore-1.35.37-py3-none-any.whl", hash = "sha256:64f965d4ba7adb8d79ce044c3aef7356e05dd74753cf7e9115b80f477845d920"}, - {file = "botocore-1.35.37.tar.gz", hash = "sha256:b2b4d29bafd95b698344f2f0577bb67064adbf1735d8a0e3c7473daa59c23ba6"}, + {file = "botocore-1.35.38-py3-none-any.whl", hash = "sha256:2eb17d32fa2d3bb5d475132a83564d28e3acc2161534f24b75a54418a1d51359"}, + {file = "botocore-1.35.38.tar.gz", hash = "sha256:55d9305c44e5ba29476df456120fa4fb919f03f066afa82f2ae400485e7465f4"}, ] [package.dependencies] @@ -1068,7 +1068,7 @@ name = "build" version = "1.2.2.post1" description = "A simple, correct Python build frontend" optional = false -python-versions = ">=3.8" +python-versions = ">= 3.8" files = [ {file = "build-1.2.2.post1-py3-none-any.whl", hash = "sha256:1d61c0887fa860c01971625baae8bdd338e517b836a2f70dd1f7aa3a6b2fc5b5"}, {file = "build-1.2.2.post1.tar.gz", hash = "sha256:b36993e92ca9375a219c99e606a122ff365a760a2d4bba0caa09bd5278b608b7"}, @@ -2345,6 +2345,26 @@ files = [ [package.extras] test = ["pytest (>=6)"] +[[package]] +name = "fal-client" +version = "0.5.0" +description = "Python client for fal.ai" +optional = false +python-versions = ">=3.8" +files = [ + {file = "fal_client-0.5.0-py3-none-any.whl", hash = "sha256:1795d80841c969a815406af5d6028bbe89f9f2ac3ca6d9b41d1d414fcb80b1bb"}, + {file = "fal_client-0.5.0.tar.gz", hash = "sha256:23fa3610a0109d105f9663220af652036c223d84edfdb377415868d8a861b0e7"}, +] + +[package.dependencies] +httpx = ">=0.21.0,<1" +httpx-sse = ">=0.4.0,<0.5" + +[package.extras] +dev = ["fal-client[docs,test]"] +docs = ["sphinx", "sphinx-autodoc-typehints", "sphinx-rtd-theme"] +test = ["pillow", "pytest", "pytest-asyncio"] + [[package]] name = "fastapi" version = "0.115.0" @@ -3905,6 +3925,17 @@ http2 = ["h2 (>=3,<5)"] socks = ["socksio (==1.*)"] zstd = ["zstandard (>=0.18.0)"] +[[package]] +name = "httpx-sse" +version = "0.4.0" +description = "Consume Server-Sent Event (SSE) messages with HTTPX." +optional = false +python-versions = ">=3.8" +files = [ + {file = "httpx-sse-0.4.0.tar.gz", hash = "sha256:1e81a3a3070ce322add1d3529ed42eb5f70817f45ed6ec915ab753f961139721"}, + {file = "httpx_sse-0.4.0-py3-none-any.whl", hash = "sha256:f329af6eae57eaa2bdfd962b42524764af68075ea87370a2de920af5341e318f"}, +] + [[package]] name = "huggingface-hub" version = "0.16.4" @@ -4386,7 +4417,7 @@ name = "langfuse" version = "2.51.5" description = "A client library for accessing langfuse" optional = false -python-versions = "<4.0,>=3.8.1" +python-versions = ">=3.8.1,<4.0" files = [ {file = "langfuse-2.51.5-py3-none-any.whl", hash = "sha256:b95401ca710ef94b521afa6541933b6f93d7cfd4a97523c8fc75bca4d6d219fb"}, {file = "langfuse-2.51.5.tar.gz", hash = "sha256:55bc37b5c5d3ae133c1a95db09117cfb3117add110ba02ebbf2ce45ac4395c5b"}, @@ -4408,13 +4439,13 @@ openai = ["openai (>=0.27.8)"] [[package]] name = "langsmith" -version = "0.1.133" +version = "0.1.134" description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform." optional = false -python-versions = "<4.0,>=3.8.1" +python-versions = ">=3.8.1,<4.0" files = [ - {file = "langsmith-0.1.133-py3-none-any.whl", hash = "sha256:82e837a6039c483beadbe19c2ba7ebafbd402d3e8105234f5ef334425cff7b45"}, - {file = "langsmith-0.1.133.tar.gz", hash = "sha256:7bfd8bef166b9a64ee540a11bee4aa7bf43b1d9229f95b0fc19086454955185d"}, + {file = "langsmith-0.1.134-py3-none-any.whl", hash = "sha256:ada98ad80ef38807725f32441a472da3dd28394010877751f48f458d3289da04"}, + {file = "langsmith-0.1.134.tar.gz", hash = "sha256:23abee3b508875a0e63c602afafffc02442a19cfd88f9daae05b3e9054fd6b61"}, ] [package.dependencies] @@ -8110,7 +8141,7 @@ name = "s3transfer" version = "0.10.3" description = "An Amazon S3 Transfer Manager" optional = false -python-versions = ">=3.8" +python-versions = ">= 3.8" files = [ {file = "s3transfer-0.10.3-py3-none-any.whl", hash = "sha256:263ed587a5803c6c708d3ce44dc4dfedaab4c1a32e8329bab818933d79ddcf5d"}, {file = "s3transfer-0.10.3.tar.gz", hash = "sha256:4f50ed74ab84d474ce614475e0b8d5047ff080810aac5d01ea25231cfc944b0c"}, @@ -8578,19 +8609,20 @@ files = [ [[package]] name = "simple-websocket" -version = "1.0.0" +version = "1.1.0" description = "Simple WebSocket server and client for Python" optional = false python-versions = ">=3.6" files = [ - {file = "simple-websocket-1.0.0.tar.gz", hash = "sha256:17d2c72f4a2bd85174a97e3e4c88b01c40c3f81b7b648b0cc3ce1305968928c8"}, - {file = "simple_websocket-1.0.0-py3-none-any.whl", hash = "sha256:1d5bf585e415eaa2083e2bcf02a3ecf91f9712e7b3e6b9fa0b461ad04e0837bc"}, + {file = "simple_websocket-1.1.0-py3-none-any.whl", hash = "sha256:4af6069630a38ed6c561010f0e11a5bc0d4ca569b36306eb257cd9a192497c8c"}, + {file = "simple_websocket-1.1.0.tar.gz", hash = "sha256:7939234e7aa067c534abdab3a9ed933ec9ce4691b0713c78acb195560aa52ae4"}, ] [package.dependencies] wsproto = "*" [package.extras] +dev = ["flake8", "pytest", "pytest-cov", "tox"] docs = ["sphinx"] [[package]] @@ -8855,13 +8887,13 @@ test = ["pytest", "tornado (>=4.5)", "typeguard"] [[package]] name = "tencentcloud-sdk-python-common" -version = "3.0.1246" +version = "3.0.1247" description = "Tencent Cloud Common SDK for Python" optional = false python-versions = "*" files = [ - {file = "tencentcloud-sdk-python-common-3.0.1246.tar.gz", hash = "sha256:a724d53d5dd6c68beff9ae1c2eb7737889d67f7724819ec5189e878e5322940b"}, - {file = "tencentcloud_sdk_python_common-3.0.1246-py2.py3-none-any.whl", hash = "sha256:e82a103cc4f1a8d07a83600604eba89e46899b005328b921dbcba9f73b3e819b"}, + {file = "tencentcloud-sdk-python-common-3.0.1247.tar.gz", hash = "sha256:1467ac3eaaa5b5d299570ba781903debc4be32dbb3f0f39929a357531ab89170"}, + {file = "tencentcloud_sdk_python_common-3.0.1247-py2.py3-none-any.whl", hash = "sha256:9829d2299c85a2494d6d816247345e98abd2f936cd309e1f67847243f5235091"}, ] [package.dependencies] @@ -8869,17 +8901,17 @@ requests = ">=2.16.0" [[package]] name = "tencentcloud-sdk-python-hunyuan" -version = "3.0.1246" +version = "3.0.1247" description = "Tencent Cloud Hunyuan SDK for Python" optional = false python-versions = "*" files = [ - {file = "tencentcloud-sdk-python-hunyuan-3.0.1246.tar.gz", hash = "sha256:099db4a80e7788e1ca09b8be45758e47a6c5976e304857f26621f958cca5b39b"}, - {file = "tencentcloud_sdk_python_hunyuan-3.0.1246-py2.py3-none-any.whl", hash = "sha256:14ad0a6787bb579a9270e6fe6ee81131a286c2f1b56cac8d7de0056983b6548f"}, + {file = "tencentcloud-sdk-python-hunyuan-3.0.1247.tar.gz", hash = "sha256:85b7332ec55f891a3b4d776e6b30ee2a44cc08c70b689615805aadff6e424fdd"}, + {file = "tencentcloud_sdk_python_hunyuan-3.0.1247-py2.py3-none-any.whl", hash = "sha256:69fdb886616e53ce02e848e5a1a8b36922db731457b07365f230ffb0aa472b5b"}, ] [package.dependencies] -tencentcloud-sdk-python-common = "3.0.1246" +tencentcloud-sdk-python-common = "3.0.1247" [[package]] name = "threadpoolctl" @@ -10339,31 +10371,37 @@ python-versions = ">=3.8" files = [ {file = "zope.interface-7.1.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2bd9e9f366a5df08ebbdc159f8224904c1c5ce63893984abb76954e6fbe4381a"}, {file = "zope.interface-7.1.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:661d5df403cd3c5b8699ac480fa7f58047a3253b029db690efa0c3cf209993ef"}, + {file = "zope.interface-7.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:91b6c30689cfd87c8f264acb2fc16ad6b3c72caba2aec1bf189314cf1a84ca33"}, {file = "zope.interface-7.1.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2b6a4924f5bad9fe21d99f66a07da60d75696a136162427951ec3cb223a5570d"}, {file = "zope.interface-7.1.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:80a3c00b35f6170be5454b45abe2719ea65919a2f09e8a6e7b1362312a872cd3"}, {file = "zope.interface-7.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:b936d61dbe29572fd2cfe13e30b925e5383bed1aba867692670f5a2a2eb7b4e9"}, {file = "zope.interface-7.1.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:0ac20581fc6cd7c754f6dff0ae06fedb060fa0e9ea6309d8be8b2701d9ea51c4"}, {file = "zope.interface-7.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:848b6fa92d7c8143646e64124ed46818a0049a24ecc517958c520081fd147685"}, + {file = "zope.interface-7.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ec1ef1fdb6f014d5886b97e52b16d0f852364f447d2ab0f0c6027765777b6667"}, {file = "zope.interface-7.1.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3bcff5c09d0215f42ba64b49205a278e44413d9bf9fa688fd9e42bfe472b5f4f"}, {file = "zope.interface-7.1.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:07add15de0cc7e69917f7d286b64d54125c950aeb43efed7a5ea7172f000fbc1"}, {file = "zope.interface-7.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:9940d5bc441f887c5f375ec62bcf7e7e495a2d5b1da97de1184a88fb567f06af"}, {file = "zope.interface-7.1.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:f245d039f72e6f802902375755846f5de1ee1e14c3e8736c078565599bcab621"}, {file = "zope.interface-7.1.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6159e767d224d8f18deff634a1d3722e68d27488c357f62ebeb5f3e2f5288b1f"}, + {file = "zope.interface-7.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5e956b1fd7f3448dd5e00f273072e73e50dfafcb35e4227e6d5af208075593c9"}, {file = "zope.interface-7.1.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ff115ef91c0eeac69cd92daeba36a9d8e14daee445b504eeea2b1c0b55821984"}, {file = "zope.interface-7.1.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bec001798ab62c3fc5447162bf48496ae9fba02edc295a9e10a0b0c639a6452e"}, {file = "zope.interface-7.1.0-cp312-cp312-win_amd64.whl", hash = "sha256:124149e2d42067b9c6597f4dafdc7a0983d0163868f897b7bb5dc850b14f9a87"}, {file = "zope.interface-7.1.0-cp313-cp313-macosx_10_9_x86_64.whl", hash = "sha256:9733a9a0f94ef53d7aa64661811b20875b5bc6039034c6e42fb9732170130573"}, {file = "zope.interface-7.1.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:5fcf379b875c610b5a41bc8a891841533f98de0520287d7f85e25386cd10d3e9"}, + {file = "zope.interface-7.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d0a45b5af9f72c805ee668d1479480ca85169312211bed6ed18c343e39307d5f"}, {file = "zope.interface-7.1.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4af4a12b459a273b0b34679a5c3dc5e34c1847c3dd14a628aa0668e19e638ea2"}, {file = "zope.interface-7.1.0-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a735f82d2e3ed47ca01a20dfc4c779b966b16352650a8036ab3955aad151ed8a"}, {file = "zope.interface-7.1.0-cp313-cp313-win_amd64.whl", hash = "sha256:5501e772aff595e3c54266bc1bfc5858e8f38974ce413a8f1044aae0f32a83a3"}, {file = "zope.interface-7.1.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:ec59fe53db7d32abb96c6d4efeed84aab4a7c38c62d7a901a9b20c09dd936e7a"}, {file = "zope.interface-7.1.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:e53c291debef523b09e1fe3dffe5f35dde164f1c603d77f770b88a1da34b7ed6"}, + {file = "zope.interface-7.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:711eebc77f2092c6a8b304bad0b81a6ce3cf5490b25574e7309fbc07d881e3af"}, {file = "zope.interface-7.1.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4a00ead2e24c76436e1b457a5132d87f83858330f6c923640b7ef82d668525d1"}, {file = "zope.interface-7.1.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5e28ea0bc4b084fc93a483877653a033062435317082cdc6388dec3438309faf"}, {file = "zope.interface-7.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:27cfb5205d68b12682b6e55ab8424662d96e8ead19550aad0796b08dd2c9a45e"}, {file = "zope.interface-7.1.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9e3e48f3dea21c147e1b10c132016cb79af1159facca9736d231694ef5a740a8"}, {file = "zope.interface-7.1.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a99240b1d02dc469f6afbe7da1bf617645e60290c272968f4e53feec18d7dce8"}, + {file = "zope.interface-7.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cc8a318162123eddbdf22fcc7b751288ce52e4ad096d3766ff1799244352449d"}, {file = "zope.interface-7.1.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b7b25db127db3e6b597c5f74af60309c4ad65acd826f89609662f0dc33a54728"}, {file = "zope.interface-7.1.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2a29ac607e970b5576547f0e3589ec156e04de17af42839eedcf478450687317"}, {file = "zope.interface-7.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:a14c9decf0eb61e0892631271d500c1e306c7b6901c998c7035e194d9150fdd1"}, @@ -10493,4 +10531,4 @@ cffi = ["cffi (>=1.11)"] [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.13" -content-hash = "d324192116c4b243e504d57f4605b79c46592a976201d903b16a910b71d84b57" +content-hash = "58586bb8201a55d63acd5c04b71340f1d2da215d00eba8e86e7b7234a585ab6e" diff --git a/api/pyproject.toml b/api/pyproject.toml index 11bcc255d7cd9..6ff3c1ac8f863 100644 --- a/api/pyproject.toml +++ b/api/pyproject.toml @@ -202,6 +202,7 @@ safetensors = "~0.4.3" arxiv = "2.1.0" cloudscraper = "1.2.71" duckduckgo-search = "~6.3.0" +fal_client = "~0.5.0" jsonpath-ng = "1.6.1" matplotlib = "~3.8.2" newspaper3k = "0.2.8"