Fix steamship import error (#7133)

Description: Fix steamship import error

When running multi_modal_output_agent:
field "steamship" not yet prepared so type is still a ForwardRef, you
might need to call SteamshipImageGenerationTool.update_forward_refs().

Tag maintainer: @hinthornw

---------

Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
Hyoseung Kim 2023-07-06 03:04:38 +09:00 committed by GitHub
parent 7d92e9407b
commit 9abf1847f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,7 @@ from langchain.tools.steamship_image_generation.utils import make_image_public
from langchain.utils import get_from_dict_or_env from langchain.utils import get_from_dict_or_env
if TYPE_CHECKING: if TYPE_CHECKING:
pass from steamship import Steamship
class ModelName(str, Enum): class ModelName(str, Enum):
@ -44,12 +44,9 @@ SUPPORTED_IMAGE_SIZES = {
class SteamshipImageGenerationTool(BaseTool): class SteamshipImageGenerationTool(BaseTool):
try:
from steamship import Steamship
except ImportError:
pass
"""Tool used to generate images from a text-prompt.""" """Tool used to generate images from a text-prompt."""
model_name: ModelName model_name: ModelName
size: Optional[str] = "512x512" size: Optional[str] = "512x512"
steamship: Steamship steamship: Steamship