Skip to content

Commit db8530b

Browse files
committed
## Python SDK Changes:
* `glean.chat.create()`: * `request.text` **Added** * `response.output[].content[].structured_output` **Added**
1 parent 5bf88df commit db8530b

37 files changed

Lines changed: 1295 additions & 110 deletions

‎.speakeasy/gen.lock‎

Lines changed: 95 additions & 43 deletions
Large diffs are not rendered by default.

‎.speakeasy/gen.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ generation:
3434
generateNewTests: true
3535
skipResponseBodyAssertions: true
3636
python:
37-
version: 0.17.14
37+
version: 0.17.15
3838
additionalDependencies:
3939
dev: {}
4040
main: {}

‎.speakeasy/glean-merged-spec.yaml‎

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ openapi: 3.1.0
22
info:
33
version: "0.9.0"
44
title: Glean API
5-
x-source-commit-sha: 5f1d873383438dc574c1075f9476915610e56875
6-
x-open-api-commit-sha: 6a8c8e16bbbca13a130766a72f307fb373b8256a
5+
x-source-commit-sha: cc70da4b874505308a45e85f609fa18587067cbf
6+
x-open-api-commit-sha: 6446870bcd3126d795a07eedf83f09f10bdb52fa
77
description: |
88
# Introduction
99
In addition to the data sources that Glean has built-in support for, Glean also provides a REST API that enables customers to put arbitrary content in the search index. This is useful, for example, for doing permissions-aware search over content in internal tools that reside on-prem as well as for searching over applications that Glean does not currently support first class. In addition these APIs allow the customer to push organization data (people info, organization structure etc) into Glean.
@@ -7444,13 +7444,72 @@ components:
74447444
content:
74457445
type: string
74467446
minLength: 1
7447+
PlatformChatTextFormat:
7448+
type: object
7449+
additionalProperties: false
7450+
description: Unconstrained plain-text assistant output.
7451+
required:
7452+
- type
7453+
properties:
7454+
type:
7455+
type: string
7456+
description: Discriminator. Must be TEXT.
7457+
enum:
7458+
- TEXT
7459+
PlatformChatJsonSchemaFormat:
7460+
type: object
7461+
additionalProperties: false
7462+
description: Constrains the assistant response to a caller-supplied JSON Schema.
7463+
required:
7464+
- type
7465+
- name
7466+
- schema
7467+
properties:
7468+
type:
7469+
type: string
7470+
description: Discriminator. Must be JSON_SCHEMA.
7471+
enum:
7472+
- JSON_SCHEMA
7473+
name:
7474+
type: string
7475+
minLength: 1
7476+
maxLength: 64
7477+
description: A stable identifier for the schema.
7478+
description:
7479+
type: string
7480+
maxLength: 1024
7481+
description: An optional human-readable description of the schema.
7482+
schema:
7483+
type: object
7484+
additionalProperties: true
7485+
description: A JSON Schema object describing the desired output shape.
7486+
strict:
7487+
type: boolean
7488+
default: true
7489+
description: |
7490+
When true, the provider validates the response against the schema. Unsupported by some providers; defaults to true.
74477491
PlatformChatCreateRequest:
74487492
type: object
74497493
additionalProperties: false
74507494
required:
74517495
- input
74527496
example:
7453-
input: What is our parental leave policy?
7497+
input: Summarize our parental leave policy as JSON.
7498+
text:
7499+
format:
7500+
type: JSON_SCHEMA
7501+
name: policy_summary
7502+
schema:
7503+
type: object
7504+
properties:
7505+
eligible_employees:
7506+
type: string
7507+
duration_weeks:
7508+
type: integer
7509+
required:
7510+
- eligible_employees
7511+
- duration_weeks
7512+
strict: true
74547513
properties:
74557514
input:
74567515
description: |
@@ -7477,6 +7536,18 @@ components:
74777536
minLength: 1
74787537
description: |
74797538
Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`.
7539+
text:
7540+
type: object
7541+
additionalProperties: false
7542+
description: |
7543+
Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true.
7544+
properties:
7545+
format:
7546+
description: |
7547+
Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema.
7548+
oneOf:
7549+
- $ref: "#/components/schemas/PlatformChatTextFormat"
7550+
- $ref: "#/components/schemas/PlatformChatJsonSchemaFormat"
74807551
PlatformChatStreamResponseId:
74817552
type: string
74827553
minLength: 1
@@ -7496,6 +7567,12 @@ components:
74967567
- OUTPUT_TEXT
74977568
text:
74987569
type: string
7570+
structured_output:
7571+
type:
7572+
- object
7573+
- "null"
7574+
description: |
7575+
Parsed and validated JSON object when structured output was requested. Present only when the request included `text.format.type: JSON_SCHEMA`.
74997576
annotations:
75007577
type: array
75017578
items:

‎.speakeasy/tests.arazzo.yaml‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159049,9 +159049,24 @@ workflows:
159049159049
requestBody:
159050159050
contentType: application/json
159051159051
payload:
159052-
input: What is our parental leave policy?
159052+
input: Summarize our parental leave policy as JSON.
159053159053
store: true
159054159054
stream: false
159055+
text:
159056+
format:
159057+
name: policy_summary
159058+
schema:
159059+
properties:
159060+
duration_weeks:
159061+
type: integer
159062+
eligible_employees:
159063+
type: string
159064+
required:
159065+
- eligible_employees
159066+
- duration_weeks
159067+
type: object
159068+
strict: true
159069+
type: JSON_SCHEMA
159055159070
successCriteria:
159056159071
- condition: $statusCode == 200
159057159072
- condition: $response.header.Content-Type == application/json

‎.speakeasy/workflow.lock‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ speakeasyVersion: 1.797.0
22
sources:
33
Glean API:
44
sourceNamespace: glean-api-specs
5-
sourceRevisionDigest: sha256:1f470e422d6b202bf6bb80cc2e4b73077b7dab6d476cda804245fc0402ea42f1
6-
sourceBlobDigest: sha256:8919e7ffe50c1ca78844cd89c216e8ab3c54a8e0003bd5072e7fe3cd35fb192c
5+
sourceRevisionDigest: sha256:27df68e6ca0bfa00c188fa0e7056d3e56209d4ecdb4d0110c8687cf8532f4f3b
6+
sourceBlobDigest: sha256:50b8e04438973d0945752232cfe3c4b685ed7e29e8107ba11791677020b49e64
77
tags:
88
- latest
99
Glean Client API:
@@ -16,10 +16,10 @@ targets:
1616
glean:
1717
source: Glean API
1818
sourceNamespace: glean-api-specs
19-
sourceRevisionDigest: sha256:1f470e422d6b202bf6bb80cc2e4b73077b7dab6d476cda804245fc0402ea42f1
20-
sourceBlobDigest: sha256:8919e7ffe50c1ca78844cd89c216e8ab3c54a8e0003bd5072e7fe3cd35fb192c
19+
sourceRevisionDigest: sha256:27df68e6ca0bfa00c188fa0e7056d3e56209d4ecdb4d0110c8687cf8532f4f3b
20+
sourceBlobDigest: sha256:50b8e04438973d0945752232cfe3c4b685ed7e29e8107ba11791677020b49e64
2121
codeSamplesNamespace: glean-api-specs-python-code-samples
22-
codeSamplesRevisionDigest: sha256:07e63ad12522c0ccf6dc9dab0943696972a489679ebc077bb6bfd23d25a123b8
22+
codeSamplesRevisionDigest: sha256:83161070dcc75aa3b71b2fecd34814f1663270067089bd1e41206524697018c5
2323
workflow:
2424
workflowVersion: 1.0.0
2525
speakeasyVersion: latest

‎README.md‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,15 +605,36 @@ The stream is also a [Context Manager][context-manager] and can be used with the
605605
underlying connection when the context is exited.
606606

607607
```python
608-
from glean.api_client import Glean
608+
from glean.api_client import Glean, models
609609
import os
610610

611611

612612
with Glean(
613613
api_token=os.getenv("GLEAN_API_TOKEN", ""),
614614
) as glean:
615615

616-
res = glean.chat.create_stream(input="What is our parental leave policy?", store=True)
616+
res = glean.chat.create_stream(input="Summarize our parental leave policy as JSON.", store=True, text={
617+
"format_": {
618+
"type": models.PlatformChatJSONSchemaFormatType.JSON_SCHEMA,
619+
"name": "policy_summary",
620+
"schema_": {
621+
"type": "object",
622+
"properties": {
623+
"eligible_employees": {
624+
"type": "string",
625+
},
626+
"duration_weeks": {
627+
"type": "integer",
628+
},
629+
},
630+
"required": [
631+
"eligible_employees",
632+
"duration_weeks",
633+
],
634+
},
635+
"strict": True,
636+
},
637+
})
617638

618639
with res as event_stream:
619640
for event in event_stream:

‎RELEASES.md‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,4 +998,14 @@ Based on:
998998
### Generated
999999
- [python v0.17.14] .
10001000
### Releases
1001-
- [PyPI v0.17.14] https://pypi.org/project/glean-api-client/0.17.14 - .
1001+
- [PyPI v0.17.14] https://pypi.org/project/glean-api-client/0.17.14 - .
1002+
1003+
## 2026-09-18 17:09:14
1004+
### Changes
1005+
Based on:
1006+
- OpenAPI Doc
1007+
- Speakeasy CLI 1.797.0 (2.937.18) https://github.com/speakeasy-api/speakeasy
1008+
### Generated
1009+
- [python v0.17.15] .
1010+
### Releases
1011+
- [PyPI v0.17.15] https://pypi.org/project/glean-api-client/0.17.15 - .
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# PlatformChatCreateFormat
2+
3+
Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema.
4+
5+
6+
7+
## Supported Types
8+
9+
### `models.PlatformChatTextFormat`
10+
11+
```python
12+
value: models.PlatformChatTextFormat = /* values here */
13+
```
14+
15+
### `models.PlatformChatJSONSchemaFormat`
16+
17+
```python
18+
value: models.PlatformChatJSONSchemaFormat = /* values here */
19+
```
20+

0 commit comments

Comments
 (0)