Hi folks... wanted to share a little pet project of mine ... LangChain Decorators adds syntactic sugar for langchain Main principles and benefits:<p>- more pythonic way of writing code
- write multiline prompts that won't break your code flow with indentation
- making use of IDE in-built support for hinting, type checking, and popup with docs to quickly peek in the function to see the prompt, parameters it consumes etc.
- leverage all the power of ' LangChain ecosystem
- adding support for optional parameters easily share parameters between the prompts by binding them to one class<p>How it works...<p>tl;dr;<p>just write declare a function and write your prompt template as python docstring...<p>for example:<p>@llm_prompt
def write_me_short_post(topic:str, platform:str="twitter", audience:str = "developers")->str:
"""
Write me a short header for my post about {topic} for {platform} platform.
It should be for {audience} audience.
(Max 15 words)
"""
return<p>it'will turn the function into an executable chain
all the other settings are considered as an implementation detail and as such you can define them elsewhere (and/or override them in decorator params)