google / google/langextract

Generated provider schema cannot be instantiated with --with-schema

Open Beginner friendly
#505 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
38.6k
Forks
2.7k
Avg merge
3d 15h
Merged PRs (30d)
3

Description

## Describe the overall issue and situation

Running the provider plugin generator with `--with-schema` creates a schema class that remains abstract. The generated class implements `supports_strict_mode`, while `BaseSchema` requires the abstract `requires_raw_output` property.

The generator reports that schema support was added, but calling `from_examples` raises a `TypeError` when it tries to instantiate the class.

## Steps to reproduce the issue

1. Generate a provider plugin:

```bash
python scripts/create_provider_plugin.py MyProvider --with-schema --no-install
```

2. Import `MyProviderSchema` from the generated package.
3. Call `MyProviderSchema.from_examples([])`.

The call fails with:

```text
TypeError: Can't instantiate abstract class MyProviderSchema without an implementation for abstract method 'requires_raw_output'
```

## Expected behavior

A schema generated by the advertised `--with-schema` workflow should implement the current `BaseSchema` contract and be instantiable through `from_examples`.

## Environment

Reproduced on current `main` at `b5fe0ba` with Python 3.12.

Contributor guide

Open the contributing guide

Research direction

Start with scripts/create_provider_plugin.py and the generated schema class, then compare its interface with BaseSchema. Run the documented generator command with --with-schema --no-install and call MyProviderSchema.from_examples([]). Done means the generated schema can be instantiated without the reported abstract-method TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.