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.1.2.tar.gz (16.8 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.1.2-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gimkit-0.1.2.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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.1.2.tar.gz
Algorithm Hash digest
SHA256 70eebbe7c08df3b73e1d595f6e50da9968b95d48afd98e9dc5c1573930507713
MD5 c60dfa0e31a287f0f8d3c4adb4535c47
BLAKE2b-256 4d66214199e3f220301efed34ed4ff02c16dcd215556e5134cb60f72b5fae322

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gimkit-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 abf3489151827b70ae80ea4682eb1d69517a1f6c96f392f590ebd82f1a6e36cc
MD5 478a7fbc62906d7d33aa26af7d50a593
BLAKE2b-256 d0a8b7e6fbbe3e245e5a55398d9fd58e7d725d0ac20dfd5582be0c14ee6865da

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