Skip to content

Conversation

mariano
Copy link
Collaborator

@mariano mariano commented Aug 11, 2025

Description

Adds config and model to extract() while maintaining full backward compatibility.

  • Added two new settings to extract():
    • config: An optional ModelConfig.
    • model: An optional BaseModel implementation.
  • Parameter precedence in extract() for model selection is as follows (from
    chosen first to last):
    • model
    • config
    • model_id (with api_key, temperature and model_url)
    • language_model_type (deprecated.)
  • Dropped unused constraints from extract()

Fixes #106

How Has This Been Tested?

All tests succeed with:

$ poetry run pytest tests/

Checklist:

  • I have read and acknowledged Google's Open Source Code of conduct.
  • I have read the Contributing page, and I either signed the Google Individual CLA or am covered by my company's Corporate CLA.
  • I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach.
  • I have made any needed documentation changes, or noted in the linked issue(s) that documentation elsewhere needs updating.
  • I have added tests, or I have ensured existing tests cover the changes
  • I have followed Google's Python Style Guide and ran pylint over the affected code.

@github-actions github-actions bot added the size/M Pull request with 150-600 lines changed label Aug 11, 2025
@aksg87 aksg87 added the ready-to-merge Triggers live API tests for PRs from forks label Aug 11, 2025
Copy link

Running live API tests... This will take a few minutes.

Copy link

✅ Live API tests passed! All endpoints are working correctly.

@aksg87
Copy link
Collaborator

aksg87 commented Aug 11, 2025

Hi @mariano thanks for the PR looks great. Just some minor updates suggested in #120 — If you can add these in that would be great!

@mariano
Copy link
Collaborator Author

mariano commented Aug 11, 2025

Hi @mariano thanks for the PR looks great. Just some minor updates suggested in #120 — If you can add these in that would be great!

Sorry about those styling issues. Incorporated your changes manually and left your PR untouched since it was targeting the the main branch on your repo rather than my fork.

@aksg87 aksg87 merged commit 1a24cd0 into google:main Aug 11, 2025
13 of 14 checks passed
@aksg87
Copy link
Collaborator

aksg87 commented Aug 11, 2025

Thanks @mariano, really appreciate the PR!

@mariano mariano deleted the extract_model_config branch August 12, 2025 15:22
aksg87 pushed a commit that referenced this pull request Aug 21, 2025
* Adding model and config parameters to extract()

* Adding extract precedence tests

* Applying changes from #120
sinnaj pushed a commit to sinnaj/langextract that referenced this pull request Sep 3, 2025
* Adding model and config parameters to extract()

* Adding extract precedence tests

* Applying changes from google#120
aksg87 added a commit that referenced this pull request Sep 12, 2025
* Adding model and config parameters to extract()

* Adding extract precedence tests

* Applying changes from #120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers live API tests for PRs from forks size/M Pull request with 150-600 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add config and model parameters to extract()

2 participants