Running Zeroshot Ner logo

Running Zeroshot Ner

CommunityPopular
maziyarpanahi
running-zeroshot-ner

Extract arbitrary, custom entity types from clinical or biomedical text with no fine-tuning using OpenMed's GLiNER / GLiNER2 zero-shot support. Use when the user wants to define their own labels on the fly (e.g. Drug, Symptom, Device, Procedure), has no labelled data or a label set not covered by a fine-tuned model, or asks about openmed zero deps/index/infer, the gliner extra, or GLiNER. Pairs adjacent to extracting-clinical-entities (use that for high-accuracy fixed-schema NER) and loading-openmed-models.

Overview

Publishermaziyarpanahi
Repositoryopenmed
Skill namerunning-zeroshot-ner
Stars
5.6K
Forks
708
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by maziyarpanahi on GitHub. Read the source before you install it.

Installation

Install the Running Zeroshot Ner AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/maziyarpanahi/openmed/tree/master/skills/running-zeroshot-ner
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/maziyarpanahi/openmed.git /tmp/openmed
mkdir -p .claude/skills
cp -r /tmp/openmed/skills/running-zeroshot-ner .claude/skills/running-zeroshot-ner
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Running Zeroshot Ner in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Running Zeroshot Ner on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Running Zeroshot Ner is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Running Zero-Shot NER

Zero-shot NER lets you extract entity types you name at inference time — no training, no labelled data. OpenMed wraps GLiNER (v1) and GLiNER2 behind a small index + inference layer, exposed via the openmed zero CLI and the openmed.ner Python API. It runs on-device.

When to use

  • Your label set is custom or evolving ("Device", "Implant", "Allergen") and no fine-tuned OpenMed model emits exactly those labels.
  • You have no labelled data to fine-tune with.
  • You need a quick prototype or a one-off extraction over an unusual schema.

When to prefer a fine-tuned model instead (extracting-clinical-entities): for a fixed, well-supported schema (diseases, drugs, anatomy), a fine-tuned OpenMed model is more accurate and faster than zero-shot. Zero-shot trades some accuracy for total label flexibility — use it for coverage of new types, then graduate to a fine-tuned model once the schema stabilises.

Install

bash
pip install "openmed[gliner]"   # pulls GLiNER (and GLiNER2 if a recent gliner is installed)
openmed zero deps               # diagnostic: prints "GLiNER v1: ok" / "GLiNER v2: ok"

openmed zero deps only checks availability — it does not install anything.

The two-step workflow: index, then infer

GLiNER checkpoints live as local model directories. OpenMed resolves them by a short model_id via an index.json, so you build the index once and run inference many times.

  1. openmed zero index <models_dir> — scan a directory of downloaded GLiNER / GLiNER2 checkpoints and write index.json (model ids, family, domains, paths).
  2. openmed zero infer "<text>" --model-id <id> — run extraction against a model from the index, with labels you supply.
bash
# 1) Build the index over your local models (writes <models_dir>/index.json)
openmed zero index /models/gliner --output /models/gliner/index.json

# 2) Run zero-shot NER with your OWN labels (comma-separated)
openmed zero infer "Patient on insulin glargine via an insulin pump for type 1 diabetes." \
  --model-id gliner-biomedical \
  --labels "Drug,Device,Disease" \
  --threshold 0.5 \
  --index-path /models/gliner/index.json

Output is JSON: each entity has text, start, end, label, and score.

CLI flags:

  • zero infer: positional text; --model-id/-m (required, an id from the index), --labels/-l (comma-separated custom labels), --domain/-d (label preset hint), --threshold/-c (default 0.5), --index-path/-i.
  • zero index: positional models_dir; --output/-o, --pretty/--compact.

If you omit --labels, OpenMed falls back to the --domain defaults (or generic defaults). Passing explicit --labels is what makes it truly zero-shot.

Python API

The same flow in code via openmed.ner:

python
from openmed.ner import infer, NerRequest

request = NerRequest(
    model_id="gliner-biomedical",          # id from your index.json
    text="Started on insulin glargine via an insulin pump for type 1 diabetes.",
    labels=["Drug", "Device", "Disease"],  # your custom labels — no fine-tuning
    threshold=0.5,
)
response = infer(request, index_path="/models/gliner/index.json")

for ent in response.entities:
    print(f"{ent.label:8} {ent.text!r:30} {ent.score:.2f} [{ent.start}:{ent.end}]")

NerRequest fields: model_id, text, labels (None ⇒ domain/default labels), domain, threshold. infer(...) returns a NerResponse whose .entities are Entity objects with .text, .start, .end, .label, .score.

Build / load the index from Python too:

python
from openmed.ner import build_index, write_index, load_index, is_gliner_available

if is_gliner_available():
    index = build_index("/models/gliner")
    write_index(index, "/models/gliner/index.json")
    index = load_index("/models/gliner/index.json")

Helpful label utilities:

python
from openmed.ner import get_default_labels, available_domains
available_domains()              # domains with built-in label presets
get_default_labels("clinical")   # default labels for a domain hint

Writing good labels

Zero-shot quality hinges on label phrasing. Prefer natural, specific noun phrases:

  • Good: ["Drug", "Medical Device", "Disease", "Symptom", "Procedure"]
  • Weak: ["X", "thing", "misc"]

Tune threshold to trade recall for precision. Start at 0.5 and raise it if you see spurious spans.

Hand-off to / from OpenMed

  • From loading-openmed-models: zero-shot uses local GLiNER checkpoints rather than the OpenMed registry; download them once, then point zero index at the directory.
  • To extracting-clinical-entities: once your label schema stabilises and a fine-tuned OpenMed model covers it, switch to openmed.analyze_text for higher accuracy and speed. The output shape (label + offsets + score) is parallel, so downstream code changes little.
  • To de-identification: run openmed.deidentify before zero-shot NER in a PHI workflow, then extract entities from the redacted text.

Edge cases & gotchas

  • zero infer needs an index. Run zero index <models_dir> first, or pass a valid --index-path; the --model-id must exist in that index.
  • zero deps doesn't install. It reports status only — install with pip install "openmed[gliner]".
  • GLiNER2 needs a recent gliner (≈0.3.0+) and a GLiNER2/Fastino checkpoint; openmed zero deps shows whether v2 is available.
  • Accuracy vs. flexibility. Zero-shot is for coverage of new/custom types, not for squeezing out maximum F1 on a standard schema.
  • Permissive licensing & local-first. Use permissively licensed GLiNER checkpoints; keep everything on-device and out of PHI logs.

Standards & references

Frequently asked questions

What does the Running Zeroshot Ner AI skill do?

Extract arbitrary, custom entity types from clinical or biomedical text with no fine-tuning using OpenMed's GLiNER / GLiNER2 zero-shot support. Use when the user wants to define their own labels on the fly (e.g. Drug, Symptom, Device, Procedure), has no labelled data or a label set not covered by a fine-tuned model, or asks about openmed zero deps/index/infer, the gliner extra, or GLiNER. Pairs adjacent to extracting-clinical-entities (use that for high-accuracy fixed-schema NER) and loading-openmed-models.

Why use Running Zeroshot Ner on TypingMind?

Because you install it once and use it with any model. Running Zeroshot Ner is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Running Zeroshot Ner in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/maziyarpanahi/openmed/tree/master/skills/running-zeroshot-ner. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Running Zeroshot Ner?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Running Zeroshot Ner?

As many as you like. As long as a model supports skills, you can use Running Zeroshot Ner with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Running Zeroshot Ner AI skill free?

Yes. It is published on GitHub by maziyarpanahi under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇