Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions docs/API_REFERENCE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- このファイルは自動生成されています。手動で編集しないでください。 -->
<!-- Generated by: python scripts/generate_api_reference.py --mode external -->
<!-- Generated at: 2026-07-04 13:16 UTC -->
<!-- Generated at: 2026-07-12 10:09 UTC -->

# GENFLUX Python SDK - API Reference

Expand Down Expand Up @@ -782,6 +782,9 @@ result = evaluator.faithfulness(
| `name` | `str` | |
| `description` | `str \| None` | |
| `locale` | `str` | |
| `consistency_repeat_count` | `int` | |
| `version` | `int` | |
| `consistency_credit_estimate` | `ConsistencyCreditEstimate \| None` | |
| `api_settings` | `ApiSettings \| None` | |
| `rag_quality_config` | `RagQualityConfig \| None` | |
| `redteam_config` | `RedteamConfig \| None` | |
Expand All @@ -802,6 +805,7 @@ result = evaluator.faithfulness(
| `name` | `str` | Config name |
| `description` | `str \| None` | Config description |
| `locale` | `str` | Locale (ja/en) |
| `consistency_repeat_count` | `int` | |
| `api_endpoint` | `str` | API endpoint URL |
| `auth_type` | `str` | Authentication type |
| `auth_header` | `str \| None` | Auth header name |
Expand Down Expand Up @@ -832,6 +836,7 @@ result = evaluator.faithfulness(
| `name` | `str \| None` | |
| `description` | `str \| None` | |
| `locale` | `str \| None` | |
| `consistency_repeat_count` | `int \| None` | |
| `api_endpoint` | `str \| None` | |
| `auth_type` | `str \| None` | |
| `auth_header` | `str \| None` | |
Expand Down Expand Up @@ -1306,6 +1311,6 @@ result = client.jobs.wait(job.id, callback=callback)

---

*Auto-generated at 2026-07-04 13:16 UTC by `scripts/generate_api_reference.py`*
*Auto-generated at 2026-07-12 10:09 UTC by `scripts/generate_api_reference.py`*

<!-- source-hash: 07ed6bb5360e8be3 -->
<!-- source-hash: 8f76d01db454282c -->
11 changes: 8 additions & 3 deletions docs/DEVELOPER_API_REFERENCE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- このファイルは自動生成されています。手動で編集しないでください。 -->
<!-- Generated by: python scripts/generate_api_reference.py --mode developer -->
<!-- Generated at: 2026-07-04 13:16 UTC -->
<!-- Generated at: 2026-07-12 10:09 UTC -->

# GENFLUX Python SDK - Developer API Reference

Expand Down Expand Up @@ -1139,6 +1139,9 @@ result = evaluator.faithfulness(
| `name` | `str` | |
| `description` | `str \| None` | |
| `locale` | `str` | |
| `consistency_repeat_count` | `int` | |
| `version` | `int` | |
| `consistency_credit_estimate` | `ConsistencyCreditEstimate \| None` | |
| `api_settings` | `ApiSettings \| None` | |
| `rag_quality_config` | `RagQualityConfig \| None` | |
| `redteam_config` | `RedteamConfig \| None` | |
Expand All @@ -1159,6 +1162,7 @@ result = evaluator.faithfulness(
| `name` | `str` | Config name |
| `description` | `str \| None` | Config description |
| `locale` | `str` | Locale (ja/en) |
| `consistency_repeat_count` | `int` | |
| `api_endpoint` | `str` | API endpoint URL |
| `auth_type` | `str` | Authentication type |
| `auth_header` | `str \| None` | Auth header name |
Expand Down Expand Up @@ -1189,6 +1193,7 @@ result = evaluator.faithfulness(
| `name` | `str \| None` | |
| `description` | `str \| None` | |
| `locale` | `str \| None` | |
| `consistency_repeat_count` | `int \| None` | |
| `api_endpoint` | `str \| None` | |
| `auth_type` | `str \| None` | |
| `auth_header` | `str \| None` | |
Expand Down Expand Up @@ -1647,6 +1652,6 @@ job.wait()用のプログレスコールバックを作成します。

---

*Auto-generated at 2026-07-04 13:16 UTC by `scripts/generate_api_reference.py`*
*Auto-generated at 2026-07-12 10:09 UTC by `scripts/generate_api_reference.py`*

<!-- source-hash: 07ed6bb5360e8be3 -->
<!-- source-hash: 8f76d01db454282c -->
5 changes: 5 additions & 0 deletions llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ Accessed via `client.reports`. Fetch evaluation reports.
| `name` | `str` | |
| `description` | `str | None` | |
| `locale` | `str` | |
| `consistency_repeat_count` | `int` | |
| `version` | `int` | |
| `consistency_credit_estimate` | `ConsistencyCreditEstimate | None` | |
| `api_settings` | `ApiSettings | None` | |
| `rag_quality_config` | `RagQualityConfig | None` | |
| `redteam_config` | `RedteamConfig | None` | |
Expand All @@ -205,6 +208,7 @@ Accessed via `client.reports`. Fetch evaluation reports.
| `name` | `str` | Config name |
| `description` | `str | None` | Config description |
| `locale` | `str` | Locale (ja/en) |
| `consistency_repeat_count` | `int` | |
| `api_endpoint` | `str` | API endpoint URL |
| `auth_type` | `str` | Authentication type |
| `auth_header` | `str | None` | Auth header name |
Expand All @@ -231,6 +235,7 @@ Accessed via `client.reports`. Fetch evaluation reports.
| `name` | `str | None` | |
| `description` | `str | None` | |
| `locale` | `str | None` | |
| `consistency_repeat_count` | `int | None` | |
| `api_endpoint` | `str | None` | |
| `auth_type` | `str | None` | |
| `auth_header` | `str | None` | |
Expand Down
14 changes: 13 additions & 1 deletion src/genflux/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ class PolicyCheckConfig(BaseModel):
policy_compliance_rate_threshold: float | None = None


class ConsistencyCreditEstimate(BaseModel):
"""Platformが算定した一貫性評価の1問あたりクレジット見積り。"""

target_call_count: int = Field(ge=1)
credits_per_prompt: int = Field(ge=0)
incremental_credits_per_prompt: int = Field(ge=0)


class Config(BaseModel):
"""完全な設定オブジェクト。"""

Expand All @@ -52,6 +60,9 @@ class Config(BaseModel):
name: str
description: str | None = None
locale: str = "ja"
consistency_repeat_count: int = Field(default=3, ge=1, le=5)
version: int = Field(default=1, ge=1)
consistency_credit_estimate: ConsistencyCreditEstimate | None = None
api_settings: ApiSettings | None = None
rag_quality_config: RagQualityConfig | None = None
redteam_config: RedteamConfig | None = None
Expand All @@ -66,6 +77,7 @@ class ConfigCreate(BaseModel):
name: str = Field(..., description="Config name")
description: str | None = Field(None, description="Config description")
locale: str = Field(default="ja", description="Locale (ja/en)")
consistency_repeat_count: int = Field(default=3, ge=1, le=5)

# API Settings (required)
api_endpoint: str = Field(..., description="API endpoint URL")
Expand Down Expand Up @@ -98,6 +110,7 @@ class ConfigUpdate(BaseModel):
name: str | None = None
description: str | None = None
locale: str | None = None
consistency_repeat_count: int | None = Field(default=None, ge=1, le=5)

# API Settings (optional)
api_endpoint: str | None = None
Expand Down Expand Up @@ -129,4 +142,3 @@ class ConfigListResponse(BaseModel):

configs: list[Config]
total: int

31 changes: 31 additions & 0 deletions tests/test_backward_compatibility.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from datetime import UTC, datetime
from uuid import UUID

from genflux import (
GenFlux,
Genflux,
GenFluxError,
GenfluxError,
)
from genflux.models.config import Config, ConfigCreate, ConfigUpdate


def test_legacy_client_name_aliases_preferred_client_name() -> None:
Expand All @@ -14,3 +18,30 @@ def test_legacy_client_name_aliases_preferred_client_name() -> None:
def test_legacy_base_exception_aliases_preferred_base_exception() -> None:
"""Legacy base exception import remains an alias of the preferred name."""
assert GenFluxError is GenfluxError


def test_consistency_policy_and_platform_estimate_round_trip() -> None:
"""設定ポリシーとPlatform算定値をSDKが欠損なく保持する。"""
created = ConfigCreate(name="Tenant policy", api_endpoint="https://example.test/rag", auth_type="none")
updated = ConfigUpdate(consistency_repeat_count=3)
config = Config(
id=UUID("00000000-0000-0000-0000-000000000001"),
tenant_id=UUID("00000000-0000-0000-0000-000000000002"),
user_id=UUID("00000000-0000-0000-0000-000000000003"),
name="Tenant policy",
consistency_repeat_count=3,
version=2,
consistency_credit_estimate={
"target_call_count": 3,
"credits_per_prompt": 3,
"incremental_credits_per_prompt": 2,
},
created_at=datetime.now(UTC),
updated_at=datetime.now(UTC),
)

assert created.consistency_repeat_count == 3
assert updated.consistency_repeat_count == 3
assert config.consistency_credit_estimate is not None
assert config.consistency_credit_estimate.target_call_count == 3
assert config.model_dump()["consistency_credit_estimate"]["credits_per_prompt"] == 3
Loading