from langchain_decorators import llm_prompt
from pydantic import BaseModel, Field
class TheOutputStructureWeExpect(BaseModel):
name: str = Field(description="The name of the company")
headline: str = Field(description="The description of the company (for landing page)")
employees: list[str] = Field(description="5-8 fake employee names with their positions")
@llm_prompt()
def fake_company_generator(company_business: str) -> TheOutputStructureWeExpect:
""" Generate a fake company that {company_business}
{FORMAT_INSTRUCTIONS}
"""
return
company = fake_company_generator(company_business="sells cookies")
# print the result nicely formatted
print("Company name: ", company.name)
print("company headline: ", company.headline)
print("company employees: ", company.employees)
Traceback (most recent call last):
File "/opt/homebrew/Caskroom/miniforge/base/envs/py310/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3577, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
runfile('/Users/betterme/PycharmProjects/AI/MeUtils/meutils/llm/output_parsers/init.py', wdir='/Users/betterme/PycharmProjects/AI/MeUtils/meutils/llm/output_parsers')
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 198, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/betterme/PycharmProjects/AI/MeUtils/meutils/llm/output_parsers/init.py", line 60, in
company = fake_company_generator(company_business="sells cookies")
File "/opt/homebrew/Caskroom/miniforge/base/envs/py310/lib/python3.10/site-packages/langchain_decorators/prompt_decorator.py", line 501, in wrapper
llmChain = build_chain(*args, **kwargs)
File "/opt/homebrew/Caskroom/miniforge/base/envs/py310/lib/python3.10/site-packages/langchain_decorators/prompt_decorator.py", line 246, in build_chain
prompt_template = PromptDecoratorTemplate.from_func(
File "/opt/homebrew/Caskroom/miniforge/base/envs/py310/lib/python3.10/site-packages/langchain_decorators/prompt_template.py", line 297, in from_func
raise Exception(f"Unsupported return type {return_type}")
Exception: Unsupported return type <class 'main.TheOutputStructureWeExpect'>
Traceback (most recent call last): File "/opt/homebrew/Caskroom/miniforge/base/envs/py310/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3577, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in
runfile('/Users/betterme/PycharmProjects/AI/MeUtils/meutils/llm/output_parsers/init.py', wdir='/Users/betterme/PycharmProjects/AI/MeUtils/meutils/llm/output_parsers')
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 198, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/betterme/PycharmProjects/AI/MeUtils/meutils/llm/output_parsers/init.py", line 60, in
company = fake_company_generator(company_business="sells cookies")
File "/opt/homebrew/Caskroom/miniforge/base/envs/py310/lib/python3.10/site-packages/langchain_decorators/prompt_decorator.py", line 501, in wrapper
llmChain = build_chain(*args, **kwargs)
File "/opt/homebrew/Caskroom/miniforge/base/envs/py310/lib/python3.10/site-packages/langchain_decorators/prompt_decorator.py", line 246, in build_chain
prompt_template = PromptDecoratorTemplate.from_func(
File "/opt/homebrew/Caskroom/miniforge/base/envs/py310/lib/python3.10/site-packages/langchain_decorators/prompt_template.py", line 297, in from_func
raise Exception(f"Unsupported return type {return_type}")
Exception: Unsupported return type <class 'main.TheOutputStructureWeExpect'>