Generate structured summaries from unstructured text using an LLM.
pip install text2structured_summaryfrom text2structured_summary import text2structured_summary
# Basic usage with default LLM7
response = text2structured_summary(
user_input="Your unstructured text here..."
)
# With custom LLM (e.g., OpenAI)
from langchain_openai import ChatOpenAI
from text2structured_summary import text2structured_summary
llm = ChatOpenAI()
response = text2structured_summary(
user_input="Your unstructured text...",
llm=llm
)
# With custom API key (LLM7)
response = text2structured_summary(
user_input="Your unstructured text...",
api_key="your_llm7_api_key"
)user_input(str): The unstructured text to be summarizedapi_key(Optional[str]): LLM7 API key (defaults to environment variableLLM7_API_KEY)llm(Optional[BaseChatModel]): Custom LangChain LLM instance (defaults to ChatLLM7)
- Uses LLM7 by default (free tier sufficient for most use cases)
- Supports custom LLMs via LangChain interface
- Returns structured summaries matching predefined pattern
- Automatic API key fallback from environment variables
- Install the package
- Call
text2structured_summary()with your text - Get structured output matching the package's pattern
- For LLM7, register at https://token.llm7.io/ for your API key
- The default pattern ensures structured output format
- Custom LLMs must implement LangChain's BaseChatModel interface
Report issues at: https://github.com/chigwell/text2structured-summary/issues
Eugene Evstafev (hi@euegne.plus)