Skip to content

Commit d92e69a

Browse files
Merge pull request #71 from shcherbak-ai/dev
Dev
2 parents 06d322f + fe53338 commit d92e69a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+10038
-2075
lines changed

.github/workflows/README.md

Lines changed: 0 additions & 72 deletions
This file was deleted.

.github/workflows/ci-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
strategy:
1919
matrix:
20-
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
20+
os: [ "ubuntu-latest" ]
2121
python-version: ["3.10", "3.11", "3.12", "3.13"]
2222

2323
defaults:

.github/workflows/daily-import-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
import-test:
10-
runs-on: macos-latest
10+
runs-on: ubuntu-latest
1111

1212
steps:
1313
- name: Set up Python 3.13

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55

66
- **Refactor**: Code reorganization that doesn't change functionality but improves structure or maintainability
77

8+
## [0.19.0](https://github.com/shcherbak-ai/contextgem/releases/tag/v0.19.0) - 2025-09-08
9+
### Added
10+
- Tool calling support in `DocumentLLM.chat(...)`.
11+
812
## [0.18.0](https://github.com/shcherbak-ai/contextgem/releases/tag/v0.18.0) - 2025-09-01
913
### Added
10-
- Chat: Added optional `chat_session` parameter (accepts a `ChatSession`) to preserve message history across turns in `DocumentLLM.chat()`. When this parameter is omitted, chat is single-turn, without message history.
14+
- Chat: Added optional `chat_session` parameter (accepts a `ChatSession`) to preserve message history across turns in `DocumentLLM.chat(...)`. When this parameter is omitted, chat is single-turn, without message history.
1115

1216
## [0.17.1](https://github.com/shcherbak-ai/contextgem/releases/tag/v0.17.1) - 2025-08-26
1317
### Changed

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ This software includes the following third-party components:
2525

2626
Core Dependencies:
2727
- aiolimiter: Rate limiting for asynchronous operations
28+
- fastjsonschema: Fast JSON schema validator
2829
- genai-prices: LLM pricing data and utilities (by Pydantic) to automatically estimate costs
2930
- Jinja2: Templating engine
3031
- litellm: LLM interface library (this software uses only MIT-licensed portions of LiteLLM and does not utilize any components from the enterprise/ directory)
@@ -44,7 +45,6 @@ Development Dependencies:
4445
- interrogate: Python docstring coverage checker
4546
- memory-profiler: Python memory usage monitoring tool
4647
- nbformat: Notebook format utilities
47-
- pip-tools: Dependency management
4848
- pre-commit: Pre-commit hooks
4949
- pympler: Python memory analysis for object-level memory measurement
5050
- pyright: Static type checker for Python

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ This project is automatically scanned for security vulnerabilities using multipl
486486
ContextGem relies on these excellent open-source packages:
487487

488488
- [aiolimiter](https://github.com/mjpieters/aiolimiter): Powerful rate limiting for async operations
489+
- [fastjsonschema](https://github.com/horejsek/python-fastjsonschema): Ultra-fast JSON schema validation
489490
- [genai-prices](https://github.com/pydantic/genai-prices): LLM pricing data and utilities (by Pydantic) to automatically estimate costs
490491
- [Jinja2](https://github.com/pallets/jinja): Fast, expressive, extensible templating engine used for prompt rendering
491492
- [litellm](https://github.com/BerriAI/litellm): Unified interface to multiple LLM providers with seamless provider switching

contextgem/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
ContextGem - Effortless LLM extraction from documents
2121
"""
2222

23-
__version__ = "0.18.0"
23+
__version__ = "0.19.0"
2424
__author__ = "Shcherbak AI AS"
2525

2626
from contextgem.public import (
@@ -49,6 +49,7 @@
4949
StringExample,
5050
create_image,
5151
image_to_base64,
52+
register_tool,
5253
reload_logger_settings,
5354
)
5455

@@ -92,4 +93,6 @@
9293
"JsonObjectClassStruct",
9394
# Converters
9495
"DocxConverter",
96+
# Decorators
97+
"register_tool",
9598
)

contextgem/internal/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
DocxConverterError,
6161
LLMAPIError,
6262
LLMExtractionError,
63+
LLMToolLoopLimitError,
6364
)
6465
from contextgem.internal.items import (
6566
_BooleanItem,
@@ -236,5 +237,6 @@
236237
# Exceptions
237238
"LLMExtractionError",
238239
"LLMAPIError",
240+
"LLMToolLoopLimitError",
239241
"DocxConverterError",
240242
)

contextgem/internal/base/abstract.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@
1212

1313
from contextgem.internal.base.mixins import _PostInitCollectorMixin
1414
from contextgem.internal.base.serialization import _InstanceSerializer
15+
from contextgem.internal.typings.types import JSONDictField, LLMRoleAny
1516

1617

1718
if TYPE_CHECKING:
1819
from contextgem.internal.data_models import (
1920
_LLMCostOutputContainer,
2021
_LLMUsageOutputContainer,
2122
)
22-
from contextgem.internal.typings.aliases import LLMRoleAny
2323

2424

2525
class _AbstractInstanceBase(_PostInitCollectorMixin, _InstanceSerializer, ABC):
2626
"""
2727
Abstract base for instance-like Pydantic models.
2828
"""
2929

30-
custom_data: dict = Field(
30+
custom_data: JSONDictField = Field(
3131
default_factory=dict,
3232
description="A serializable dictionary for storing additional custom data "
3333
"related to the instance.",
@@ -110,3 +110,13 @@ def reset_usage_and_cost(self) -> None:
110110
may support optional filters (e.g., by role) where applicable.
111111
"""
112112
pass
113+
114+
@abstractmethod
115+
def _warn_tools_ignored_if_enabled(self) -> None:
116+
"""
117+
Abstract method, to be implemented by subclasses.
118+
119+
Should warn that tools are ignored during extraction
120+
workflows if tools are configured. Tools are supported only in ``llm.chat(...)``.
121+
"""
122+
pass

contextgem/internal/base/aspects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
from contextgem.internal.base.paras_and_sents import _Paragraph, _Sentence
4646
from contextgem.internal.decorators import _disable_direct_initialization
4747
from contextgem.internal.items import _StringItem
48-
from contextgem.internal.typings.aliases import (
48+
from contextgem.internal.typings.types import (
4949
LLMRoleAspect,
5050
NonEmptyStr,
5151
ReferenceDepth,

0 commit comments

Comments
 (0)