Skip to content

Commit 32c9c7d

Browse files
committed
chore: speakeasy run
Re-generate code and documentation using the latest Speakeasy version.
1 parent 7d4c8b2 commit 32c9c7d

File tree

129 files changed

+1235
-1126
lines changed

Some content is hidden

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

129 files changed

+1235
-1126
lines changed

.speakeasy/gen.lock

Lines changed: 505 additions & 504 deletions
Large diffs are not rendered by default.

.speakeasy/glean-merged-spec.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ paths:
841841
tags:
842842
- Agents
843843
summary: Search agents
844-
description: "Search for [agents](https://developers.glean.com/agents/agents-api) by agent name. "
844+
description: Search for [agents](https://developers.glean.com/agents/agents-api) by agent name.
845845
operationId: searchAgents
846846
x-visibility: Preview
847847
requestBody:
@@ -7554,6 +7554,11 @@ components:
75547554
$ref: "#/components/schemas/Message"
75557555
title: Messages
75567556
description: The messages to pass an input to the agent.
7557+
metadata:
7558+
type: object
7559+
title: Metadata
7560+
description: The metadata to pass to the agent.
7561+
additionalProperties: true
75577562
AgentExecutionStatus:
75587563
description: The status of the run. One of 'error', 'success'.
75597564
type: string

.speakeasy/workflow.lock

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
speakeasyVersion: 1.558.0
1+
speakeasyVersion: 1.561.0
22
sources:
33
Glean API:
44
sourceNamespace: glean-api-specs
5-
sourceRevisionDigest: sha256:8a528d68d247ecb98ea1d9d49c135154477cbfbab078b6159359a09f64628fba
6-
sourceBlobDigest: sha256:09d1624a9a347738790040f1fcdc5f2eff15461dd39941a1535efb55e2c8939f
5+
sourceRevisionDigest: sha256:def878110682ba33071e9369f2fc13e9ace94ee3de38b09cbcc5ad93fa083bfb
6+
sourceBlobDigest: sha256:eceb178c5d2537e6d21c0461c81f6af1dc245da2c327fdf5305a8191184eff94
77
tags:
88
- latest
9-
- speakeasy-sdk-regen-1749491200
109
Glean Client API:
1110
sourceNamespace: glean-client-api
1211
sourceRevisionDigest: sha256:4edc63ad559e4f2c9fb9ebf5edaaaaa9269f1874d271cfd84b441d6dacac43d2
@@ -17,10 +16,10 @@ targets:
1716
glean:
1817
source: Glean API
1918
sourceNamespace: glean-api-specs
20-
sourceRevisionDigest: sha256:8a528d68d247ecb98ea1d9d49c135154477cbfbab078b6159359a09f64628fba
21-
sourceBlobDigest: sha256:09d1624a9a347738790040f1fcdc5f2eff15461dd39941a1535efb55e2c8939f
19+
sourceRevisionDigest: sha256:def878110682ba33071e9369f2fc13e9ace94ee3de38b09cbcc5ad93fa083bfb
20+
sourceBlobDigest: sha256:eceb178c5d2537e6d21c0461c81f6af1dc245da2c327fdf5305a8191184eff94
2221
codeSamplesNamespace: glean-api-specs-python-code-samples
23-
codeSamplesRevisionDigest: sha256:d2defba5ce9f2980f4c7a8ed3cd58df2629ca3a2e7c380959c3028c6f231d6ab
22+
codeSamplesRevisionDigest: sha256:8acf66e50535d8fa865214fd70de55e2f04e299bae90925154b6ebb3bbb936c6
2423
workflow:
2524
workflowVersion: 1.0.0
2625
speakeasyVersion: latest

README.md

Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Remember that each namespace requires its own authentication token type as descr
4949
* [SDK Example Usage](#sdk-example-usage)
5050
* [Authentication](#authentication)
5151
* [Available Resources and Operations](#available-resources-and-operations)
52+
* [File uploads](#file-uploads)
5253
* [Retries](#retries)
5354
* [Error Handling](#error-handling)
5455
* [Server Selection](#server-selection)
@@ -141,9 +142,9 @@ import os
141142

142143
with Glean(
143144
api_token=os.getenv("GLEAN_API_TOKEN", ""),
144-
) as g_client:
145+
) as glean:
145146

146-
res = g_client.client.chat.create(messages=[
147+
res = glean.client.chat.create(messages=[
147148
{
148149
"fragments": [
149150
models.ChatMessageFragment(
@@ -170,9 +171,9 @@ async def main():
170171

171172
async with Glean(
172173
api_token=os.getenv("GLEAN_API_TOKEN", ""),
173-
) as g_client:
174+
) as glean:
174175

175-
res = await g_client.client.chat.create_async(messages=[
176+
res = await glean.client.chat.create_async(messages=[
176177
{
177178
"fragments": [
178179
models.ChatMessageFragment(
@@ -198,9 +199,9 @@ import os
198199

199200
with Glean(
200201
api_token=os.getenv("GLEAN_API_TOKEN", ""),
201-
) as g_client:
202+
) as glean:
202203

203-
res = g_client.client.chat.create_stream(messages=[
204+
res = glean.client.chat.create_stream(messages=[
204205
{
205206
"fragments": [
206207
models.ChatMessageFragment(
@@ -227,9 +228,9 @@ async def main():
227228

228229
async with Glean(
229230
api_token=os.getenv("GLEAN_API_TOKEN", ""),
230-
) as g_client:
231+
) as glean:
231232

232-
res = await g_client.client.chat.create_stream_async(messages=[
233+
res = await glean.client.chat.create_stream_async(messages=[
233234
{
234235
"fragments": [
235236
models.ChatMessageFragment(
@@ -266,9 +267,9 @@ import os
266267

267268
with Glean(
268269
api_token=os.getenv("GLEAN_API_TOKEN", ""),
269-
) as g_client:
270+
) as glean:
270271

271-
g_client.client.activity.report(events=[
272+
glean.client.activity.report(events=[
272273
{
273274
"action": models.ActivityEventAction.HISTORICAL_VIEW,
274275
"timestamp": parse_datetime("2000-01-23T04:56:07.000Z"),
@@ -534,6 +535,38 @@ For more information on obtaining the appropriate token type, please contact you
534535
</details>
535536
<!-- End Available Resources and Operations [operations] -->
536537

538+
<!-- Start File uploads [file-upload] -->
539+
## File uploads
540+
541+
Certain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
542+
543+
> [!TIP]
544+
>
545+
> For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files.
546+
>
547+
548+
```python
549+
from glean.api_client import Glean
550+
import os
551+
552+
553+
with Glean(
554+
api_token=os.getenv("GLEAN_API_TOKEN", ""),
555+
) as glean:
556+
557+
res = glean.client.chat.upload_files(files=[
558+
{
559+
"file_name": "example.file",
560+
"content": open("example.file", "rb"),
561+
},
562+
])
563+
564+
# Handle response
565+
print(res)
566+
567+
```
568+
<!-- End File uploads [file-upload] -->
569+
537570
<!-- Start Retries [retries] -->
538571
## Retries
539572

@@ -548,9 +581,9 @@ import os
548581

549582
with Glean(
550583
api_token=os.getenv("GLEAN_API_TOKEN", ""),
551-
) as g_client:
584+
) as glean:
552585

553-
g_client.client.activity.report(events=[
586+
glean.client.activity.report(events=[
554587
{
555588
"action": models.ActivityEventAction.HISTORICAL_VIEW,
556589
"timestamp": parse_datetime("2000-01-23T04:56:07.000Z"),
@@ -590,9 +623,9 @@ import os
590623
with Glean(
591624
retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
592625
api_token=os.getenv("GLEAN_API_TOKEN", ""),
593-
) as g_client:
626+
) as glean:
594627

595-
g_client.client.activity.report(events=[
628+
glean.client.activity.report(events=[
596629
{
597630
"action": models.ActivityEventAction.HISTORICAL_VIEW,
598631
"timestamp": parse_datetime("2000-01-23T04:56:07.000Z"),
@@ -728,9 +761,9 @@ import os
728761
with Glean(
729762
instance="<value>"
730763
api_token=os.getenv("GLEAN_API_TOKEN", ""),
731-
) as g_client:
764+
) as glean:
732765

733-
g_client.client.activity.report(events=[
766+
glean.client.activity.report(events=[
734767
{
735768
"action": models.ActivityEventAction.HISTORICAL_VIEW,
736769
"timestamp": parse_datetime("2000-01-23T04:56:07.000Z"),
@@ -771,9 +804,9 @@ import os
771804
with Glean(
772805
server_url="https://instance-name-be.glean.com",
773806
api_token=os.getenv("GLEAN_API_TOKEN", ""),
774-
) as g_client:
807+
) as glean:
775808

776-
g_client.client.activity.report(events=[
809+
glean.client.activity.report(events=[
777810
{
778811
"action": models.ActivityEventAction.HISTORICAL_VIEW,
779812
"timestamp": parse_datetime("2000-01-23T04:56:07.000Z"),
@@ -898,7 +931,7 @@ def main():
898931

899932
with Glean(
900933
api_token=os.getenv("GLEAN_API_TOKEN", ""),
901-
) as g_client:
934+
) as glean:
902935
# Rest of application here...
903936

904937

@@ -907,7 +940,7 @@ async def amain():
907940

908941
async with Glean(
909942
api_token=os.getenv("GLEAN_API_TOKEN", ""),
910-
) as g_client:
943+
) as glean:
911944
# Rest of application here...
912945
```
913946
<!-- End Resource Management [resource-management] -->
@@ -923,7 +956,7 @@ from glean.api_client import Glean
923956
import logging
924957

925958
logging.basicConfig(level=logging.DEBUG)
926-
s = Glean(debug_logger=logging.getLogger("glean"))
959+
s = Glean(debug_logger=logging.getLogger("glean.api_client"))
927960
```
928961

929962
You can also enable a default debug logger by setting an environment variable `GLEAN_DEBUG` to true.

USAGE.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import os
77

88
with Glean(
99
api_token=os.getenv("GLEAN_API_TOKEN", ""),
10-
) as g_client:
10+
) as glean:
1111

12-
res = g_client.client.chat.create(messages=[
12+
res = glean.client.chat.create(messages=[
1313
{
1414
"fragments": [
1515
models.ChatMessageFragment(
@@ -36,9 +36,9 @@ async def main():
3636

3737
async with Glean(
3838
api_token=os.getenv("GLEAN_API_TOKEN", ""),
39-
) as g_client:
39+
) as glean:
4040

41-
res = await g_client.client.chat.create_async(messages=[
41+
res = await glean.client.chat.create_async(messages=[
4242
{
4343
"fragments": [
4444
models.ChatMessageFragment(
@@ -62,9 +62,9 @@ import os
6262

6363
with Glean(
6464
api_token=os.getenv("GLEAN_API_TOKEN", ""),
65-
) as g_client:
65+
) as glean:
6666

67-
res = g_client.client.chat.create_stream(messages=[
67+
res = glean.client.chat.create_stream(messages=[
6868
{
6969
"fragments": [
7070
models.ChatMessageFragment(
@@ -91,9 +91,9 @@ async def main():
9191

9292
async with Glean(
9393
api_token=os.getenv("GLEAN_API_TOKEN", ""),
94-
) as g_client:
94+
) as glean:
9595

96-
res = await g_client.client.chat.create_stream_async(messages=[
96+
res = await glean.client.chat.create_stream_async(messages=[
9797
{
9898
"fragments": [
9999
models.ChatMessageFragment(

docs/models/agentrun.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ Payload for creating a run.
1010
| `agent_id` | *str* | :heavy_check_mark: | The ID of the agent to run. |
1111
| `input` | Dict[str, *Any*] | :heavy_minus_sign: | The input to the agent. |
1212
| `messages` | List[[models.Message](../models/message.md)] | :heavy_minus_sign: | The messages to pass an input to the agent. |
13+
| `metadata` | Dict[str, *Any*] | :heavy_minus_sign: | The metadata to pass to the agent. |
1314
| `status` | [Optional[models.AgentExecutionStatus]](../models/agentexecutionstatus.md) | :heavy_minus_sign: | The status of the run. One of 'error', 'success'. |

docs/models/agentruncreate.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ Payload for creating a run.
99
| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- |
1010
| `agent_id` | *str* | :heavy_check_mark: | The ID of the agent to run. |
1111
| `input` | Dict[str, *Any*] | :heavy_minus_sign: | The input to the agent. |
12-
| `messages` | List[[models.Message](../models/message.md)] | :heavy_minus_sign: | The messages to pass an input to the agent. |
12+
| `messages` | List[[models.Message](../models/message.md)] | :heavy_minus_sign: | The messages to pass an input to the agent. |
13+
| `metadata` | Dict[str, *Any*] | :heavy_minus_sign: | The metadata to pass to the agent. |

docs/sdks/agents/README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import os
2424

2525
with Glean(
2626
api_token=os.getenv("GLEAN_API_TOKEN", ""),
27-
) as g_client:
27+
) as glean:
2828

29-
res = g_client.client.agents.retrieve(agent_id="<id>")
29+
res = glean.client.agents.retrieve(agent_id="<id>")
3030

3131
# Handle response
3232
print(res)
@@ -64,9 +64,9 @@ import os
6464

6565
with Glean(
6666
api_token=os.getenv("GLEAN_API_TOKEN", ""),
67-
) as g_client:
67+
) as glean:
6868

69-
res = g_client.client.agents.retrieve_schemas(agent_id="<id>")
69+
res = glean.client.agents.retrieve_schemas(agent_id="<id>")
7070

7171
# Handle response
7272
print(res)
@@ -93,7 +93,7 @@ with Glean(
9393

9494
## list
9595

96-
Search for [agents](https://developers.glean.com/agents/agents-api) by agent name.
96+
Search for [agents](https://developers.glean.com/agents/agents-api) by agent name.
9797

9898
### Example Usage
9999

@@ -104,9 +104,9 @@ import os
104104

105105
with Glean(
106106
api_token=os.getenv("GLEAN_API_TOKEN", ""),
107-
) as g_client:
107+
) as glean:
108108

109-
res = g_client.client.agents.list(name="HR Policy Agent")
109+
res = glean.client.agents.list(name="HR Policy Agent")
110110

111111
# Handle response
112112
print(res)
@@ -143,9 +143,9 @@ import os
143143

144144
with Glean(
145145
api_token=os.getenv("GLEAN_API_TOKEN", ""),
146-
) as g_client:
146+
) as glean:
147147

148-
res = g_client.client.agents.run_stream(agent_id="<id>")
148+
res = glean.client.agents.run_stream(agent_id="<id>")
149149

150150
# Handle response
151151
print(res)
@@ -159,6 +159,7 @@ with Glean(
159159
| `agent_id` | *str* | :heavy_check_mark: | The ID of the agent to run. |
160160
| `input` | Dict[str, *Any*] | :heavy_minus_sign: | The input to the agent. |
161161
| `messages` | List[[models.Message](../../models/message.md)] | :heavy_minus_sign: | The messages to pass an input to the agent. |
162+
| `metadata` | Dict[str, *Any*] | :heavy_minus_sign: | The metadata to pass to the agent. |
162163
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
163164

164165
### Response
@@ -184,9 +185,9 @@ import os
184185

185186
with Glean(
186187
api_token=os.getenv("GLEAN_API_TOKEN", ""),
187-
) as g_client:
188+
) as glean:
188189

189-
res = g_client.client.agents.run(agent_id="<id>")
190+
res = glean.client.agents.run(agent_id="<id>")
190191

191192
# Handle response
192193
print(res)
@@ -200,6 +201,7 @@ with Glean(
200201
| `agent_id` | *str* | :heavy_check_mark: | The ID of the agent to run. |
201202
| `input` | Dict[str, *Any*] | :heavy_minus_sign: | The input to the agent. |
202203
| `messages` | List[[models.Message](../../models/message.md)] | :heavy_minus_sign: | The messages to pass an input to the agent. |
204+
| `metadata` | Dict[str, *Any*] | :heavy_minus_sign: | The metadata to pass to the agent. |
203205
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
204206

205207
### Response

0 commit comments

Comments
 (0)