Skip to main content

go-concise-summary

PyPI version License: MIT Downloads LinkedIn

A lightweight helper library that takes a technical description or code snippet about Go concurrency concepts and returns a structured, concise summary. It is especially useful for extracting key details such as purpose, usage, and implementation notes from a fair, cancelable semaphore or other concurrency patterns.

The package is available on PyPI as go_concise_summary and works as a drop‑in function that can use the default ChatLLM7 model or any LangChain compatible LLM.


Installation

pip install go_concise_summary

Basic Usage

from go_concise_summary import go_concise_summary

user_text = """
A fair, cancelable semaphore in Go can be implemented using a counting semaphore
pattern with a context for cancellation. Its purpose is to limit concurrent
access to a resource while ensuring that waiting goroutines are notified when
the semaphore is released or when the context is cancelled.
"""

summary = go_concise_summary(
    user_input=user_text
)

print(summary)
# Output will be a list of strings matching the expected regex pattern.

Function Signature

def go_concise_summary(
    user_input: str,
    api_key: Optional[str] = None,
    llm: Optional[BaseChatModel] = None
) -> List[str]
Argument Type Description
user_input str The Go concurrency description or code that you want summarized.
api_key Optional[str] API key for the default ChatLLM7 service. If omitted, the function will look for an environment variable LLM7_API_KEY.
llm Optional[BaseChatModel] A LangChain LLM instance. If supplied, the function will use this LLM instead of the default ChatLLM7.

Overriding the LLM

The library ships with a bundled ChatLLM7 instance, but you can pass any LangChain LLM that implements BaseChatModel.

OpenAI

from langchain_openai import ChatOpenAI
from go_concise_summary import go_concise_summary

llm = ChatOpenAI()
summary = go_concise_summary(user_input=text, llm=llm)

Anthropic

from langchain_anthropic import ChatAnthropic
from go_concise_summary import go_concise_summary

llm = ChatAnthropic()
summary = go_concise_summary(user_input=text, llm=llm)

Google Gemini

from langchain_google_genai import ChatGoogleGenerativeAI
from go_concise_summary import go_concise_summary

llm = ChatGoogleGenerativeAI()
summary = go_concise_summary(user_input=text, llm=llm)

Using a Custom LLM7 API Key

If you require higher rate limits than the default free tier, create or export an LLM7 API key:

export LLM7_API_KEY="your-api-key-here"

or pass it directly:

summary = go_concise_summary(user_input=text, api_key="your_api_key_here")

Free LLM7 API keys can be obtained at https://token.llm7.io/.


How It Works

  1. Prompting – The function composes a system prompt (system_prompt) and a user prompt (human_prompt) that instruct the model to produce a concise, structured summary of the Go concurrency snippet.
  2. LLM Call – It sends the prompts to the configured LLM.
  3. Regex Extraction – Using the pre‑defined pattern, the response is validated and formatted. The extracted information is returned as a List[str].

Issues & Support

Found a bug or have a feature request? Open an issue here: https://github.com/chigwell/go-concise-summary/issues


Author

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

go_concise_summary-2025.12.21141123.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

go_concise_summary-2025.12.21141123-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file go_concise_summary-2025.12.21141123.tar.gz.

File metadata

File hashes

Hashes for go_concise_summary-2025.12.21141123.tar.gz
Algorithm Hash digest
SHA256 50f01ecf44bbbed80ac1dca4cdf81407b39734138a181e16a3e223f18b788118
MD5 265446d912640bdd44cc143ae20722ad
BLAKE2b-256 da20d390bb2269a7e7073820d2e4c42fa3262d47bd392387ea5f67c7be0b026b

See more details on using hashes here.

File details

Details for the file go_concise_summary-2025.12.21141123-py3-none-any.whl.

File metadata

File hashes

Hashes for go_concise_summary-2025.12.21141123-py3-none-any.whl
Algorithm Hash digest
SHA256 4aeea284c84f5c58f1dce08a0a83b0313664c83953afadacebed631b345f4680
MD5 8a253b870bf92cfc6408e3c72d7c7b71
BLAKE2b-256 c300417708bb429300417931cb889213e614295334d8cf5aae213d41b876a29c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2025.12.21141123 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page