langchain
langchain copied to clipboard
DOC: SteamshipImageGenerationTool returns Config Error in multi_modal_output_agent.ipynb
Issue with current documentation:
When running multi_modal_output_agent.ipynb: https://python.langchain.com/en/latest/use_cases/agents/multi_modal_output_agent.html, I get ConfigError: field "steamship" not yet prepared so type is still a ForwardRef, you might need to call SteamshipImageGenerationTool.update_forward_refs().
tools = [ SteamshipImageGenerationTool(model_name= "dall-e") ]
ConfigError Traceback (most recent call last) Cell In[7], line 2 1 tools = [ ----> 2 SteamshipImageGenerationTool(model_name= "dall-e") 3 ]
File ~/miniconda3/envs/langchain/lib/python3.11/site-packages/pydantic/main.py:339, in pydantic.main.BaseModel.init()
File ~/miniconda3/envs/langchain/lib/python3.11/site-packages/pydantic/main.py:1076, in pydantic.main.validate_model()
File ~/miniconda3/envs/langchain/lib/python3.11/site-packages/pydantic/fields.py:860, in pydantic.fields.ModelField.validate()
ConfigError: field "steamship" not yet prepared so type is still a ForwardRef, you might need to call SteamshipImageGenerationTool.update_forward_refs().
After I call SteamshipImageGenerationTool.update_forward_refs(), I get another error.
SteamshipImageGenerationTool.update_forward_refs()
NameError Traceback (most recent call last) Cell In[10], line 1 ----> 1 SteamshipImageGenerationTool.update_forward_refs()
File ~/miniconda3/envs/langchain/lib/python3.11/site-packages/pydantic/main.py:815, in pydantic.main.BaseModel.update_forward_refs()
File ~/miniconda3/envs/langchain/lib/python3.11/site-packages/pydantic/typing.py:562, in pydantic.typing.update_model_forward_refs()
File ~/miniconda3/envs/langchain/lib/python3.11/site-packages/pydantic/typing.py:528, in pydantic.typing.update_field_forward_refs()
File ~/miniconda3/envs/langchain/lib/python3.11/site-packages/pydantic/typing.py:66, in pydantic.typing.evaluate_forwardref()
File ~/miniconda3/envs/langchain/lib/python3.11/typing.py:864, in ForwardRef.evaluate(self, globalns, localns, recursive_guard) 859 if self.forward_module is not None: 860 globalns = getattr( 861 sys.modules.get(self.forward_module, None), 'dict', globalns 862 ) 863 type = _type_check( --> 864 eval(self.forward_code, globalns, localns), 865 "Forward references must evaluate to types.", 866 is_argument=self.forward_is_argument, 867 allow_special_forms=self.forward_is_class, 868 ) 869 self.forward_value = eval_type( 870 type, globalns, localns, recursive_guard | {self.forward_arg} 871 ) 872 self.forward_evaluated = True
File
NameError: name 'Steamship' is not defined
Idea or request for content:
No response
I've encountered the same issue. The source for the SteamShipGenerationTool class be found here: [https://python.langchain.com/en/latest/_modules/langchain/tools/steamship_image_generation/tool.html]. I redefined the class without the "try: from steamship import Steamship" block and imported Steamship outside of the class' scope. It seems to work.
@PAndreew Could you give more details about your solution? I found the source for SteamshipImageGenerationTool on https://github.com/hwchase17/langchain/tree/master/langchain/tools/steamship_image_generation, download and commented the lines with Steamship, but after importing NameError: name 'Steamship' is not defined stile appear.
I am still getting this error
I am still getting this error
Same here, so what's wrong?
Is there a solution to this problem, the above link seems to be invalid
Hi, @panyi121! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.
Based on my understanding, the issue you reported is related to the documentation for the SteamshipImageGenerationTool causing a ConfigError when running the multi_modal_output_agent.ipynb notebook. User PAndreew found a workaround by redefining the class without the "try: from steamship import Steamship" block and importing Steamship outside of the class' scope. However, it seems that this solution did not work for user ls-git-17 who encountered a NameError. Other users, including rajib76 and MatrixA, are also experiencing the same error and are still looking for a solution.
Now, we would like to know if this issue is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on this issue. Otherwise, feel free to close the issue yourself or it will be automatically closed in 7 days.
Thank you for your understanding and contribution to the LangChain project. Let us know if you have any further questions or concerns.
I'm facing the same error, so what's wrong?