A package for converting textual descriptions of visual design, layout, or interface concepts to structured representations or annotations.
This package enables users to input textual descriptions of visual design, layout, or interface concepts and returns structured representations or annotations derived from the description. It leverages language model interactions coupled with pattern matching to extract key elements such as components, relationships, and attributes, facilitating tasks like generating structured design tokens, verifying design specifications, or creating markup descriptions.
pip install text2designfrom text2design import text2design
response = text2design(user_input="a description of the design")You can also use a langchain LLM instance instead of the default ChatLLM7 instance:
from langchain_openai import ChatOpenAI
from text2design import text2design
llm = ChatOpenAI()
response = text2design(user_input="a description of the design", llm=llm)user_input: str, the user input text to processllm: Optional[BaseChatModel], the langchain LLM instance to use, defaults toChatLLM7api_key: Optional[str], the api key forLLM7, can be set via environment variableLLM7_API_KEYor passed directly
This package uses ChatLLM7 from langchain_llm7 by default. You can pass your own LLM instance, for example:
- OpenAI:
from langchain_openai import ChatOpenAI
from text2design import text2design
llm = ChatOpenAI()
response = text2design(user_input, llm=llm)- Anthropic:
from langchain_anthropic import ChatAnthropic
from text2design import text2design
llm = ChatAnthropic()
response = text2design(user_input, llm=llm)- Google Generative AI:
from langchain_google_genai import ChatGoogleGenerativeAI
from text2design import text2design
llm = ChatGoogleGenerativeAI()
response = text2design(user_input, llm=llm)The default free tier for LLM7 is sufficient for most use cases. For higher rate limits:
- Set your API key via environment variable
LLM7_API_KEY - Or pass it directly:
text2design(user_input, api_key="your_api_key")
You can register for a free API key at https://token.llm7.io/.
For issues or feature requests, please visit: https://github....
- Eugene Evstafev (hi@eugene.plus)
- GitHub: chigwell