Skip to content

Commit 528e427

Browse files
SDK regeneration
Unable to analyze changes with AI, incrementing PATCH version.
1 parent abb6a3f commit 528e427

38 files changed

+352
-439
lines changed

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## 0.0.9 - 2025-12-18
2+
* SDK regeneration
3+
* Unable to analyze changes with AI, incrementing PATCH version.
4+

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "phenoml",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"private": false,
55
"repository": "github:PhenoML/phenoml-ts-sdk",
66
"type": "commonjs",

reference.md

Lines changed: 20 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,8 @@ Send a message to an agent and receive a response
444444

445445
```typescript
446446
await client.agent.chat({
447+
"X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
448+
"X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
447449
message: "What is the patient's current condition?",
448450
agent_id: "agent-123"
449451
});
@@ -1272,72 +1274,6 @@ await client.construe.extractCodes({
12721274
</dl>
12731275

12741276

1275-
</dd>
1276-
</dl>
1277-
</details>
1278-
1279-
<details><summary><code>client.construe.<a href="/src/api/resources/construe/client/Client.ts">cohort</a>({ ...params }) -> phenoml.ConstrueCohortResponse</code></summary>
1280-
<dl>
1281-
<dd>
1282-
1283-
#### 📝 Description
1284-
1285-
<dl>
1286-
<dd>
1287-
1288-
<dl>
1289-
<dd>
1290-
1291-
Creates a patient cohort based on a natural language description.
1292-
Translates the description into FHIR search queries and optional SQL queries.
1293-
</dd>
1294-
</dl>
1295-
</dd>
1296-
</dl>
1297-
1298-
#### 🔌 Usage
1299-
1300-
<dl>
1301-
<dd>
1302-
1303-
<dl>
1304-
<dd>
1305-
1306-
```typescript
1307-
await client.construe.cohort({
1308-
text: "Between 20 and 40 years old with hyperlipidemia"
1309-
});
1310-
1311-
```
1312-
</dd>
1313-
</dl>
1314-
</dd>
1315-
</dl>
1316-
1317-
#### ⚙️ Parameters
1318-
1319-
<dl>
1320-
<dd>
1321-
1322-
<dl>
1323-
<dd>
1324-
1325-
**request:** `phenoml.construe.ConstrueCohortRequest`
1326-
1327-
</dd>
1328-
</dl>
1329-
1330-
<dl>
1331-
<dd>
1332-
1333-
**requestOptions:** `Construe.RequestOptions`
1334-
1335-
</dd>
1336-
</dl>
1337-
</dd>
1338-
</dl>
1339-
1340-
13411277
</dd>
13421278
</dl>
13431279
</details>
@@ -1373,7 +1309,8 @@ The request is proxied to the configured FHIR server with appropriate authentica
13731309

13741310
```typescript
13751311
await client.fhir.search("550e8400-e29b-41d4-a716-446655440000", "Patient", {
1376-
"X-Phenoml-On-Behalf-Of": "[email protected]"
1312+
"X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
1313+
"X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c..."
13771314
});
13781315

13791316
```
@@ -1466,7 +1403,8 @@ The request is proxied to the configured FHIR server with appropriate authentica
14661403

14671404
```typescript
14681405
await client.fhir.create("550e8400-e29b-41d4-a716-446655440000", "Patient", {
1469-
"X-Phenoml-On-Behalf-Of": "[email protected]",
1406+
"X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
1407+
"X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
14701408
body: {
14711409
resourceType: "Patient",
14721410
name: [
@@ -1572,7 +1510,8 @@ The request is proxied to the configured FHIR server with appropriate authentica
15721510

15731511
```typescript
15741512
await client.fhir.upsert("550e8400-e29b-41d4-a716-446655440000", "Patient", {
1575-
"X-Phenoml-On-Behalf-Of": "[email protected]",
1513+
"X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
1514+
"X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
15761515
body: {
15771516
resourceType: "Patient",
15781517
id: "123",
@@ -1680,7 +1619,8 @@ The request is proxied to the configured FHIR server with appropriate authentica
16801619

16811620
```typescript
16821621
await client.fhir.delete("550e8400-e29b-41d4-a716-446655440000", "Patient", {
1683-
"X-Phenoml-On-Behalf-Of": "[email protected]"
1622+
"X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
1623+
"X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c..."
16841624
});
16851625

16861626
```
@@ -1778,7 +1718,8 @@ The request is proxied to the configured FHIR server with appropriate authentica
17781718

17791719
```typescript
17801720
await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
1781-
"X-Phenoml-On-Behalf-Of": "[email protected]",
1721+
"X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
1722+
"X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
17821723
body: [{
17831724
op: "replace",
17841725
path: "/name/0/family",
@@ -1878,7 +1819,8 @@ The request is proxied to the configured FHIR server with appropriate authentica
18781819

18791820
```typescript
18801821
await client.fhir.executeBundle("550e8400-e29b-41d4-a716-446655440000", {
1881-
"X-Phenoml-On-Behalf-Of": "[email protected]",
1822+
"X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
1823+
"X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
18821824
body: {
18831825
resourceType: "Bundle",
18841826
entry: [{
@@ -3120,6 +3062,8 @@ Converts natural language to FHIR resource and optionally stores it in a FHIR se
31203062

31213063
```typescript
31223064
await client.tools.createFhirResource({
3065+
"X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
3066+
"X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
31233067
resource: "auto",
31243068
text: "Patient John Doe has severe asthma with acute exacerbation"
31253069
});
@@ -3186,6 +3130,8 @@ Converts natural language to FHIR search parameters and executes search in FHIR
31863130

31873131
```typescript
31883132
await client.tools.searchFhirResources({
3133+
"X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
3134+
"X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
31893135
text: "Find all appointments for patient John Doe next week"
31903136
});
31913137

@@ -3251,6 +3197,8 @@ Uses LLM to extract search concepts from natural language and builds patient coh
32513197

32523198
```typescript
32533199
await client.tools.analyzeCohort({
3200+
"X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
3201+
"X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
32543202
text: "female patients over 20 with diabetes but not hypertension",
32553203
provider: "550e8400-e29b-41d4-a716-446655440000"
32563204
});

src/Client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export class phenomlClient {
4040
{
4141
"X-Fern-Language": "JavaScript",
4242
"X-Fern-SDK-Name": "phenoml",
43-
"X-Fern-SDK-Version": "0.0.8",
44-
"User-Agent": "phenoml/0.0.8",
43+
"X-Fern-SDK-Version": "0.0.9",
44+
"User-Agent": "phenoml/AUTO",
4545
"X-Fern-Runtime": core.RUNTIME.type,
4646
"X-Fern-Runtime-Version": core.RUNTIME.version,
4747
},

src/api/resources/agent/client/Client.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,8 @@ export class Agent {
593593
*
594594
* @example
595595
* await client.agent.chat({
596+
* "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
597+
* "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
596598
* message: "What is the patient's current condition?",
597599
* agent_id: "agent-123"
598600
* })
@@ -608,9 +610,18 @@ export class Agent {
608610
request: phenoml.agent.AgentChatRequest,
609611
requestOptions?: Agent.RequestOptions,
610612
): Promise<core.WithRawResponse<phenoml.agent.AgentChatResponse>> {
613+
const {
614+
"X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf,
615+
"X-Phenoml-Fhir-Provider": phenomlFhirProvider,
616+
..._body
617+
} = request;
611618
const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
612619
this._options?.headers,
613-
mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader() }),
620+
mergeOnlyDefinedHeaders({
621+
Authorization: await this._getAuthorizationHeader(),
622+
"X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
623+
"X-Phenoml-Fhir-Provider": phenomlFhirProvider != null ? phenomlFhirProvider : undefined,
624+
}),
614625
requestOptions?.headers,
615626
);
616627
const _response = await (this._options.fetcher ?? core.fetcher)({
@@ -625,7 +636,7 @@ export class Agent {
625636
contentType: "application/json",
626637
queryParameters: requestOptions?.queryParams,
627638
requestType: "json",
628-
body: request,
639+
body: _body,
629640
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
630641
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
631642
abortSignal: requestOptions?.abortSignal,

src/api/resources/agent/client/requests/AgentChatRequest.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,23 @@
33
/**
44
* @example
55
* {
6+
* "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
7+
* "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
68
* message: "What is the patient's current condition?",
79
* agent_id: "agent-123"
810
* }
911
*/
1012
export interface AgentChatRequest {
13+
/**
14+
* Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
15+
* Must be in the format: Patient/{uuid} or Practitioner/{uuid}
16+
*/
17+
"X-Phenoml-On-Behalf-Of"?: string;
18+
/**
19+
* Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
20+
* Multiple FHIR provider integrations can be provided as comma-separated values.
21+
*/
22+
"X-Phenoml-Fhir-Provider"?: string;
1123
/** The message to send to the agent */
1224
message: string;
1325
/** Optional context for the conversation */

src/api/resources/construe/client/Client.ts

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -227,102 +227,6 @@ export class Construe {
227227
}
228228
}
229229

230-
/**
231-
* Creates a patient cohort based on a natural language description.
232-
* Translates the description into FHIR search queries and optional SQL queries.
233-
*
234-
* @param {phenoml.construe.ConstrueCohortRequest} request
235-
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
236-
*
237-
* @throws {@link phenoml.construe.BadRequestError}
238-
* @throws {@link phenoml.construe.UnauthorizedError}
239-
* @throws {@link phenoml.construe.InternalServerError}
240-
*
241-
* @example
242-
* await client.construe.cohort({
243-
* text: "Between 20 and 40 years old with hyperlipidemia"
244-
* })
245-
*/
246-
public cohort(
247-
request: phenoml.construe.ConstrueCohortRequest,
248-
requestOptions?: Construe.RequestOptions,
249-
): core.HttpResponsePromise<phenoml.construe.ConstrueCohortResponse> {
250-
return core.HttpResponsePromise.fromPromise(this.__cohort(request, requestOptions));
251-
}
252-
253-
private async __cohort(
254-
request: phenoml.construe.ConstrueCohortRequest,
255-
requestOptions?: Construe.RequestOptions,
256-
): Promise<core.WithRawResponse<phenoml.construe.ConstrueCohortResponse>> {
257-
const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
258-
this._options?.headers,
259-
mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader() }),
260-
requestOptions?.headers,
261-
);
262-
const _response = await (this._options.fetcher ?? core.fetcher)({
263-
url: core.url.join(
264-
(await core.Supplier.get(this._options.baseUrl)) ??
265-
(await core.Supplier.get(this._options.environment)) ??
266-
environments.phenomlEnvironment.Default,
267-
"construe/cohort",
268-
),
269-
method: "POST",
270-
headers: _headers,
271-
contentType: "application/json",
272-
queryParameters: requestOptions?.queryParams,
273-
requestType: "json",
274-
body: request,
275-
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
276-
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
277-
abortSignal: requestOptions?.abortSignal,
278-
});
279-
if (_response.ok) {
280-
return {
281-
data: _response.body as phenoml.construe.ConstrueCohortResponse,
282-
rawResponse: _response.rawResponse,
283-
};
284-
}
285-
286-
if (_response.error.reason === "status-code") {
287-
switch (_response.error.statusCode) {
288-
case 400:
289-
throw new phenoml.construe.BadRequestError(_response.error.body as unknown, _response.rawResponse);
290-
case 401:
291-
throw new phenoml.construe.UnauthorizedError(
292-
_response.error.body as unknown,
293-
_response.rawResponse,
294-
);
295-
case 500:
296-
throw new phenoml.construe.InternalServerError(
297-
_response.error.body as unknown,
298-
_response.rawResponse,
299-
);
300-
default:
301-
throw new errors.phenomlError({
302-
statusCode: _response.error.statusCode,
303-
body: _response.error.body,
304-
rawResponse: _response.rawResponse,
305-
});
306-
}
307-
}
308-
309-
switch (_response.error.reason) {
310-
case "non-json":
311-
throw new errors.phenomlError({
312-
statusCode: _response.error.statusCode,
313-
body: _response.error.rawBody,
314-
rawResponse: _response.rawResponse,
315-
});
316-
case "timeout":
317-
throw new errors.phenomlTimeoutError("Timeout exceeded when calling POST /construe/cohort.");
318-
case "unknown":
319-
throw new errors.phenomlError({
320-
message: _response.error.errorMessage,
321-
rawResponse: _response.rawResponse,
322-
});
323-
}
324-
}
325-
326230
protected async _getAuthorizationHeader(): Promise<string> {
327231
return `Bearer ${await core.Supplier.get(this._options.token)}`;
328232
}

src/api/resources/construe/client/requests/ConstrueCohortRequest.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
export type { ConstrueCohortRequest } from "./ConstrueCohortRequest.js";
21
export type { ExtractRequest } from "./ExtractRequest.js";
32
export type { UploadRequest } from "./UploadRequest.js";

src/api/resources/construe/types/BadRequestErrorBody.ts

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

0 commit comments

Comments
 (0)