Skip to content

SculptAI/GIMKit

Repository files navigation

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)