Skip to main content

Structured text generation and information extraction toolkit for language models

Project description

GIMKit

PyPI Version Supported Python versions Supported Platforms

Guided Infilling Modeling Toolkit — structured text generation and information extraction using language models.

Write a template with typed placeholders. The LLM fills them in. Get structured, named results back.

from gimkit import guide as g

query = f"""Extract from: "Hi, I'm John Smith, reach me at john@gmail.com"

Name: {g.person_name(name="name")}
Email: {g.e_mail(name="email")}"""

result = model(query, use_gim_prompt=True)
result.tags["name"].content   # → "John Smith"
result.tags["email"].content  # → "john@gmail.com"

Installation

pip install gimkit

For vLLM support:

pip install gimkit[vllm]

What Can You Do With GIMKit?

GIMKit is a general-purpose information extraction framework. Write a natural-language template with embedded tags, and the model extracts structured data from any text.

Use Case Example
Contact extraction Parse names, emails, phones from free-form text
Named entity recognition Extract orgs, people, locations, dates
Text classification Categorize text, assign sentiment labels
Event extraction Pull what/where/when/impact from event descriptions
Relation extraction Find entities and the relationships between them
Resume parsing Extract name, title, education, experience
Review analysis Parse product, price, rating, pros/cons

See the Classic IE Use Cases, Privacy and PII Use Cases, and Other Use Cases pages for full examples.

Why GIMKit?

  • Template-driven — describe what you want in natural language, not label lists
  • Format control — regex constraints, enumerated choices, type-safe tags
  • Named access — results are keyed by field name, not token positions
  • Small-model friendly — works with compact open-source models (4B+)
  • Multiple backends — OpenAI, vLLM (server and offline)

Quick Start

from openai import OpenAI
from gimkit import from_openai, guide as g

client = OpenAI()
model = from_openai(client, model_name="gpt-4")

# Simple extraction
result = model(f"Hello, {g(desc='a single word')}!", use_gim_prompt=True)
print(result)  # Hello, world!

# Structured form
query = f"""
Name: {g.person_name(name="name")}
Email: {g.e_mail(name="email")}
Favorite color: {g.select(name="color", choices=["red", "green", "blue"])}
"""
result = model(query, use_gim_prompt=True)
print(result.tags["name"].content)
print(result.tags["email"].content)
print(result.tags["color"].content)

Project details


Download files

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

Source Distribution

gimkit-0.2.1.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

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

gimkit-0.2.1-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

Details for the file gimkit-0.2.1.tar.gz.

File metadata

  • Download URL: gimkit-0.2.1.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for gimkit-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1e4e237f65c6f574333a8dddb338d9de85d1c5857237938183bdc2950078244b
MD5 5032f1cd8053efe7a1561b708216d309
BLAKE2b-256 c248c6077e24a2f362c5531f528e0fea69fa6f79e63119904eaf8cb24a8e514d

See more details on using hashes here.

File details

Details for the file gimkit-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: gimkit-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 24.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for gimkit-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 84175443577731994e943005ea50a58b570a8d638a96d5b822b908cfe6222e48
MD5 cdb746ac290502a474eb5b08703a56e0
BLAKE2b-256 166e678f5b495fae4a6ccd2bc0f9c095c9f1fe47c23a3248ccf09f8318f8988a

See more details on using hashes here.

Supported by

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