Skip to content

Pacific AI Releases LangTest 2.8.0: MedExQA and HeadQA Support, Unified text-generation Task for Hugging Face Models, Embedding Evaluation Fixes, and Security Enhancements

Latest

Choose a tag to compare

@chakravarthik27 chakravarthik27 released this 17 Aug 04:30
771ca46

๐Ÿ“ข Highlights

We're excited to announce the latest LangTest release, expanding clinical benchmark coverage, unifying Hugging Face model handling, and hardening the library and documentation website.

  • ๐Ÿฉบ MedExQA: Medical Question Answering Benchmark:
    LangTest now supports MedExQA, a medical QA benchmark covering five underrepresented specialties: biomedical engineering, clinical laboratory science, clinical psychology, occupational therapy, and speech-language pathology.

  • ๐Ÿง  HeadQA: Complex Healthcare Reasoning Benchmark:
    We've added support for HeadQA, a multiple-choice benchmark drawn from healthcare specialization exams. It covers medicine, nursing, pharmacology, psychology, biology, and chemistry.

  • ๐Ÿ”„ Unified text-generation Task for Hugging Face Models:
    Translation, summarization, and text2text-generation tasks for Hugging Face models using the transformers package have been migrated to a single text-generation pathway. This removes per-task pipeline branching, aligns local model behavior with hosted LLM hubs, and makes it substantially simpler to add new Hugging Face models.

  • ๐Ÿงฎ Embedding-Based Functionalities Restored on the Latest OpenAI SDK:
    Embedding-based functionalities have been migrated from the deprecated OpenAI interface to the current SDK client and its updated response format. Similarity scoring for embedding-driven metrics now works reliably on modern SDK versions, with no configuration changes needed on your side.

  • ๐Ÿ”’ Security Enhancements:
    Vulnerabilities and security issues have been resolved across both the core library and the documentation website, reinforcing LangTest's overall stability and safety.

๐Ÿ”ฅ Key Enhancements

๐Ÿฉบ MedExQA: Medical Question Answering with Multiple Explanations

Open In Colab

We've added support for MedExQA, a medical question-answering benchmark built around five underrepresented specialties: biomedical engineering, clinical laboratory science, clinical psychology, occupational therapy, and speech-language pathology.

Key Features:

  • Covers five specialties that are typically missing from mainstream medical benchmarks.
  • Works with the full robustness test suite to measure stability under input perturbations.
  • Subset selection lets you target a single specialty or evaluate across all of them.

How it works:

#Import Harness from the LangTest library
from langtest import Harness
import os

os.environ["OPENAI_API_KEY"] = "<YOUR_API_KEY>"

Prompt:

prompt = """
You are a medical expert specializing in clinical reasoning and medical knowledge.

You will be given:
1. A medical multiple-choice question.
2. Five answer options labeled A, B, C, D and E.

Your task is to:
- Select the single best answer based on established medical knowledge.
- Return only the corresponding option letter.

Rules:
- Output exactly one uppercase letter: A, B, C, D or E.
- Do not provide any explanation, reasoning, punctuation, or additional text.

Example:

Question:
What is the most common cause of hypothyroidism in the United States?

Options:
A) Iodine deficiency
B) Hashimoto's thyroiditis
C) Graves' disease
D) Thyroidectomy
E) Secondary hypothyroidism

Output(A, B, C, D or E):
B

Now answer the following question.

Question:
{question}

Options:
{options}

Output(A, B, C, D or E):

"""

Harness Setup:

harness = Harness(
    task="question-answering",
    model={
        "model": "gpt-5.6-luna", 
        "hub": "openai",
        "type": "chat"
    },
    data={"data_source": "MedExQA",
          "subset": "all",
          "split": "test"},
    config={
        "model_parameters": {
            "user_prompt": prompt
        },
        'tests': {
            'defaults': {
                'min_pass_rate': 0.65
            },
            'robustness': {
                'uppercase': {'min_pass_rate': 0.66},
                'lowercase': {'min_pass_rate': 0.66},
                'add_ocr_typo': {'min_pass_rate': 0.66},
                'dyslexia_word_swap': {'min_pass_rate': 0.60}
            }
        }
    }
)

Execution:

harness.generate().run().report()
image

๐Ÿง  HeadQA: Complex Healthcare Reasoning Benchmark

Open In Colab

LangTest now supports HeadQA, a multiple-choice benchmark sourced from healthcare specialization exams, available in LangTest. The questions are drawn from professional certification exams across medicine, nursing, pharmacology, psychology, biology, and chemistry.

Key Features:

  • Exam-grade questions spanning healthcare and life-science domains.
  • Emphasizes multi-step clinical and scientific reasoning over memorization.
  • English-language support for consistent evaluation across model hubs.
  • Compatible with the robustness suite to measure stability under perturbed inputs.

How it works:

#Import Harness from the LangTest library
from langtest import Harness
import os

os.environ["OPENAI_API_KEY"] = "<YOUR_API_KEY>"

Prompt:

prompt = """
You are a medical expert specializing in clinical reasoning and medical knowledge.

You will be given:
1. A medical multiple-choice question.
2. Five answer options labeled A, B, C, D, and E.

Your task is to:
- Select the single best answer based on established medical knowledge.
- Return only the corresponding option letter.

Rules:
- Output exactly one uppercase letter: A, B, C, D, or E.
- Do not provide any explanation, reasoning, punctuation, or additional text.

Example:

Question:
What is the most common cause of hypothyroidism in the United States?

Options:
A) Iodine deficiency
B) Hashimoto's thyroiditis
C) Graves' disease
D) Thyroidectomy
E) Secondary hypothyroidism

Output(A, B, C, D or E):
B

Now answer the following question.

Question:
{question}

Options:
{options}

Output(A, B, C, D or E):
"""

Harness Setup:

harness = Harness(
    task="question-answering",
    model={
        "model": "gpt-5.6-luna", 
        "hub": "openai",
        "type": "chat"
    },
    data={"data_source": "HeadQA",
          "split": "test"},
    config={
        "model_parameters": {
            "user_prompt": prompt
        },
        'tests': {
            'defaults': {
                'min_pass_rate': 0.65
            },
            'robustness': {
                'uppercase': {'min_pass_rate': 0.66},
                'lowercase': {'min_pass_rate': 0.66},
                'add_ocr_typo': {'min_pass_rate': 0.66},
                'dyslexia_word_swap': {'min_pass_rate': 0.60}
            }
        }
    }
)

Execution:

harness.generate().run().report()
image

๐Ÿ”„ Unified text-generation Task for Hugging Face Models

The translation, summarization, and text2text-generation tasks for Hugging Face transformers models have been consolidated into a single text-generation pipeline, giving one consistent interface across local and hosted models.

  • Transformers v5 removed the corresponding pipeline() helpers; LangTest now handles seq2seq loading internally through AutoTokenizer and AutoModelForSeq2SeqLM.
  • Fully internal refactor โ€” no configuration changes needed, with local models now aligned to hosted LLM hub behavior.

๐Ÿงฎ OpenAI SDK v1 Migration for Embedding-Based Evaluation

Embedding-based functionalities have been migrated from the deprecated OpenAI interface to the current SDK client, restoring reliable similarity scoring for embedding-driven metrics.

  • What broke: OpenaiEmbeddings relied on the pre-1.x openai.Embedding.create() endpoint and module-level openai.api_key assignment, both removed in the modern SDK โ€” causing embedding functionalities to fail outright on current openai versions.
  • What's fixed: The class now instantiates a proper SDK client with the API key and calls the current embeddings endpoint, with response parsing updated from dictionary subscripting to the SDK's typed response objects.
  • No changes required on your side: Existing evaluation configs using embedding metrics work as before โ€” single-string and batched list inputs both continue to return correctly shaped vectors.

๐Ÿ”’ Security Enhancements

Vulnerabilities and security issues have been resolved across both the core library and the documentation website, reinforcing LangTest's overall stability and safety.

  • Core library: Flagged vulnerabilities addressed and affected dependencies updated to patched versions.
  • Documentation website: Security issues on the docs site remediated, including dependency-level fixes.

What's Changed

Full Changelog: 2.7.0...2.8.0