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
6 changes: 3 additions & 3 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"cliVersion": "5.49.1",
"cliVersion": "5.50.1",
"generatorName": "fernapi/fern-python-sdk",
"generatorVersion": "5.14.13",
"generatorConfig": {
Expand All @@ -8,10 +8,10 @@
"enabled": true
}
},
"originGitCommit": "64f369254225bd6c2d4c58d87f59165d7e8e8dc9",
"originGitCommit": "fbaef4c66e97232edfaacb20d23d476aa286ecdd",
"originGitCommitIsDirty": true,
"invokedBy": "ci",
"requestedVersion": "AUTO",
"ciProvider": "unknown",
"sdkVersion": "16.2.0"
"sdkVersion": "16.3.0"
}
25 changes: 20 additions & 5 deletions .fern/replay.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [16.3.0] - 2026-06-18
### Added
- **`phenoml.agent.errors.ConflictError`** — new `ApiError` subclass raised by `client.agent.chat.send(...)` and `client.agent.chat.stream(...)` for HTTP 409 responses when a session already has an active turn.

### Changed
- **`client.agent.chat.send(...)` and `client.agent.chat.stream(...)` `session_id` parameter** — docstring now states that only one request may be active per session at a time and overlapping turns return `409 Conflict`.
- **`client.fhir2omop.create(...)`** — docstring now lists the supported FHIR resource-to-OMOP table mappings and clarifies that unsupported resource types are accepted but ignored.
- **`CreateOmopResponse.dropped`** — field description now clarifies that only supported resources missing required subject/patient, code, or medication reference data appear in `dropped`; unsupported resource types are ignored.

## [16.2.0] - 2026-06-15
### Added
- **`Provider`** — `"aidbox"` is now a supported FHIR provider value in the `Provider` union type.
Expand Down Expand Up @@ -567,4 +576,3 @@ from phenoml import PhenomlClient
* Update documentation to reflect removed parameter
* Remove AgentCreateRequest.is_active field from type definitions
* 🌿 Generated with Fern

4 changes: 2 additions & 2 deletions code-examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"metadata": {
"language": "python",
"packageName": "phenoml",
"sdkVersion": "16.2.0",
"specCommit": "64f369254225bd6c2d4c58d87f59165d7e8e8dc9",
"sdkVersion": "16.3.0",
"specCommit": "fbaef4c66e97232edfaacb20d23d476aa286ecdd",
"generatorName": "fernapi/fern-python-sdk"
},
"renderRules": {
Expand Down
12 changes: 6 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dynamic = ["version"]

[tool.poetry]
name = "phenoml"
version = "16.2.0"
version = "16.3.0"
description = ""
readme = "README.md"
authors = []
Expand Down
39 changes: 34 additions & 5 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ Multiple FHIR provider integrations can be provided as comma-separated values.
<dl>
<dd>

**session_id:** `typing.Optional[str]` — Optional session ID for conversation continuity
**session_id:** `typing.Optional[str]` — Optional session ID for conversation continuity. Only one request may be active for a session at a time; overlapping turns for the same session return 409 Conflict.

</dd>
</dl>
Expand Down Expand Up @@ -732,7 +732,7 @@ Multiple FHIR provider integrations can be provided as comma-separated values.
<dl>
<dd>

**session_id:** `typing.Optional[str]` — Optional session ID for conversation continuity
**session_id:** `typing.Optional[str]` — Optional session ID for conversation continuity. Only one request may be active for a session at a time; overlapping turns for the same session return 409 Conflict.

</dd>
</dl>
Expand Down Expand Up @@ -3526,6 +3526,32 @@ Maps a FHIR R4 resource or Bundle into OMOP Common Data Model v5.4 rows
(person, visit_occurrence, condition_occurrence, drug_exposure,
procedure_occurrence, measurement, observation).

Resource support is intentionally limited to the OMOP tables returned by
this endpoint:
- `Patient` -> `person`
- `Encounter` -> `visit_occurrence`
- `Condition` -> `condition_occurrence`
- `Procedure` -> `procedure_occurrence`
- `MedicationRequest`, `MedicationStatement`, and
`MedicationAdministration` -> `drug_exposure`
- `Immunization` -> `drug_exposure`
- `Observation` with a numeric `valueQuantity`, `valueInteger`, or
numeric-looking `valueString` (for example `"<2"`) -> `measurement`
- non-numeric `Observation` -> `observation`
- `AllergyIntolerance` -> `observation`

`Medication` is supported only as reference data for medication
resources; it is not emitted as its own row because OMOP CDM has no
Medication table. Other reference/admin resources such as `Practitioner`,
`Organization`, `Location`, `Coverage`, and `Claim`, and clinical
workflow/document resources such as `DiagnosticReport`, `ServiceRequest`,
`CarePlan`, `DocumentReference`, `Composition`, `Specimen`, and
`DeviceUseStatement`, are currently accepted in a Bundle but are not
shaped into OMOP rows. Unsupported resource types are ignored rather than
listed under `dropped`; `dropped` is reserved for supported resource types
that were missing the subject/patient, code, or medication reference data
needed to produce a valid row.

Each resource's primary clinical coding is resolved to a standard OMOP
`concept_id`. Alongside the OMOP rows grouped by table (`tables`), the
response carries `mappings` (how each source coding resolved, linked back
Expand Down Expand Up @@ -3599,9 +3625,12 @@ client.fhir2omop.create(
**fhir_resources:** `typing.Dict[str, typing.Any]`

FHIR resources (single resource or Bundle). Must contain at least one
Patient resource. Resources are mapped to OMOP rows; standalone
Medication resources are consumed by medication references rather than
mapped to their own table.
Patient resource. Supported row-producing resources are Patient,
Encounter, Condition, Procedure, MedicationRequest,
MedicationStatement, MedicationAdministration, Immunization,
Observation, and AllergyIntolerance. Standalone Medication resources
are consumed by medication references rather than mapped to their own
table. Other resource types are accepted but ignored.

</dd>
</dl>
Expand Down
3 changes: 3 additions & 0 deletions src/phenoml/agent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
)
from .errors import (
BadRequestError,
ConflictError,
ForbiddenError,
GatewayTimeoutError,
InternalServerError,
Expand All @@ -52,6 +53,7 @@
"ChatMessageTemplate": ".types",
"ChatMessageTemplateRole": ".types",
"ChatSessionTemplate": ".types",
"ConflictError": ".errors",
"DeleteResponse": ".types",
"ForbiddenError": ".errors",
"GatewayTimeoutError": ".errors",
Expand Down Expand Up @@ -109,6 +111,7 @@ def __dir__():
"ChatMessageTemplate",
"ChatMessageTemplateRole",
"ChatSessionTemplate",
"ConflictError",
"DeleteResponse",
"ForbiddenError",
"GatewayTimeoutError",
Expand Down
8 changes: 4 additions & 4 deletions src/phenoml/agent/chat/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def send(
Optional context for the conversation

session_id : typing.Optional[str]
Optional session ID for conversation continuity
Optional session ID for conversation continuity. Only one request may be active for a session at a time; overlapping turns for the same session return 409 Conflict.

enhanced_reasoning : typing.Optional[bool]
Enable enhanced reasoning capabilities. Increases latency but improves response quality and reliability.
Expand Down Expand Up @@ -143,7 +143,7 @@ def stream(
Optional context for the conversation

session_id : typing.Optional[str]
Optional session ID for conversation continuity
Optional session ID for conversation continuity. Only one request may be active for a session at a time; overlapping turns for the same session return 409 Conflict.

enhanced_reasoning : typing.Optional[bool]
Enable enhanced reasoning capabilities. Increases latency but improves response quality and reliability.
Expand Down Expand Up @@ -304,7 +304,7 @@ async def send(
Optional context for the conversation

session_id : typing.Optional[str]
Optional session ID for conversation continuity
Optional session ID for conversation continuity. Only one request may be active for a session at a time; overlapping turns for the same session return 409 Conflict.

enhanced_reasoning : typing.Optional[bool]
Enable enhanced reasoning capabilities. Increases latency but improves response quality and reliability.
Expand Down Expand Up @@ -390,7 +390,7 @@ async def stream(
Optional context for the conversation

session_id : typing.Optional[str]
Optional session ID for conversation continuity
Optional session ID for conversation continuity. Only one request may be active for a session at a time; overlapping turns for the same session return 409 Conflict.

enhanced_reasoning : typing.Optional[bool]
Enable enhanced reasoning capabilities. Increases latency but improves response quality and reliability.
Expand Down
53 changes: 49 additions & 4 deletions src/phenoml/agent/chat/raw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from ...core.pydantic_utilities import parse_obj_as, parse_sse_obj
from ...core.request_options import RequestOptions
from ..errors.bad_request_error import BadRequestError
from ..errors.conflict_error import ConflictError
from ..errors.forbidden_error import ForbiddenError
from ..errors.gateway_timeout_error import GatewayTimeoutError
from ..errors.internal_server_error import InternalServerError
Expand Down Expand Up @@ -68,7 +69,7 @@ def send(
Optional context for the conversation

session_id : typing.Optional[str]
Optional session ID for conversation continuity
Optional session ID for conversation continuity. Only one request may be active for a session at a time; overlapping turns for the same session return 409 Conflict.

enhanced_reasoning : typing.Optional[bool]
Enable enhanced reasoning capabilities. Increases latency but improves response quality and reliability.
Expand Down Expand Up @@ -153,6 +154,17 @@ def send(
),
),
)
if _response.status_code == 409:
raise ConflictError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 500:
raise InternalServerError(
headers=dict(_response.headers),
Expand Down Expand Up @@ -222,7 +234,7 @@ def stream(
Optional context for the conversation

session_id : typing.Optional[str]
Optional session ID for conversation continuity
Optional session ID for conversation continuity. Only one request may be active for a session at a time; overlapping turns for the same session return 409 Conflict.

enhanced_reasoning : typing.Optional[bool]
Enable enhanced reasoning capabilities. Increases latency but improves response quality and reliability.
Expand Down Expand Up @@ -331,6 +343,17 @@ def _iter():
),
),
)
if _response.status_code == 409:
raise ConflictError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 500:
raise InternalServerError(
headers=dict(_response.headers),
Expand Down Expand Up @@ -535,7 +558,7 @@ async def send(
Optional context for the conversation

session_id : typing.Optional[str]
Optional session ID for conversation continuity
Optional session ID for conversation continuity. Only one request may be active for a session at a time; overlapping turns for the same session return 409 Conflict.

enhanced_reasoning : typing.Optional[bool]
Enable enhanced reasoning capabilities. Increases latency but improves response quality and reliability.
Expand Down Expand Up @@ -620,6 +643,17 @@ async def send(
),
),
)
if _response.status_code == 409:
raise ConflictError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 500:
raise InternalServerError(
headers=dict(_response.headers),
Expand Down Expand Up @@ -689,7 +723,7 @@ async def stream(
Optional context for the conversation

session_id : typing.Optional[str]
Optional session ID for conversation continuity
Optional session ID for conversation continuity. Only one request may be active for a session at a time; overlapping turns for the same session return 409 Conflict.

enhanced_reasoning : typing.Optional[bool]
Enable enhanced reasoning capabilities. Increases latency but improves response quality and reliability.
Expand Down Expand Up @@ -798,6 +832,17 @@ async def _iter():
),
),
)
if _response.status_code == 409:
raise ConflictError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
parse_obj_as(
type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
if _response.status_code == 500:
raise InternalServerError(
headers=dict(_response.headers),
Expand Down
Loading