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.0.tar.gz (18.0 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.0-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gimkit-0.2.0.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","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.0.tar.gz
Algorithm Hash digest
SHA256 c0bc540d321573547a6e6054d18924ec2bcbb6ee074fdeb989f22bba07d8a54d
MD5 f07e9835b79cc56e7b9ab11ce45417ee
BLAKE2b-256 4984265d305edf7d892876e7b4671a0fc6684f7f96232e58134662f3bae66532

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gimkit-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 823d5811c30e17946c25001272e009e834289a6fe9f6227dbe4bde2e922cc376
MD5 0d13f1690fa41e770396c3fa16401c20
BLAKE2b-256 8d0816df3b538a6e8e2c6e63bb585380cfa985eb11b67afc8087a422698eaa30

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