| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 73764ef commit c80030e
129 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -841,7 +841,7 @@ paths: | |||
| 841 | 841 | tags: | |
| 842 | 842 | - Agents | |
| 843 | 843 | 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. | ||
| 845 | 845 | operationId: searchAgents | |
| 846 | 846 | x-visibility: Preview | |
| 847 | 847 | requestBody: | |
@@ -7554,6 +7554,11 @@ components: | |||
| 7554 | 7554 | $ref: "#/components/schemas/Message" | |
| 7555 | 7555 | title: Messages | |
| 7556 | 7556 | 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 | ||
| 7557 | 7562 | AgentExecutionStatus: | |
| 7558 | 7563 | description: The status of the run. One of 'error', 'success'. | |
| 7559 | 7564 | type: string | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,12 +1,11 @@ | |||
| 1 | - speakeasyVersion: 1.558.0 | ||
| 1 | + speakeasyVersion: 1.561.0 | ||
| 2 | 2 | sources: | |
| 3 | 3 | Glean API: | |
| 4 | 4 | sourceNamespace: glean-api-specs | |
| 5 | - sourceRevisionDigest: sha256:8a528d68d247ecb98ea1d9d49c135154477cbfbab078b6159359a09f64628fba | ||
| 6 | - sourceBlobDigest: sha256:09d1624a9a347738790040f1fcdc5f2eff15461dd39941a1535efb55e2c8939f | ||
| 5 | + sourceRevisionDigest: sha256:def878110682ba33071e9369f2fc13e9ace94ee3de38b09cbcc5ad93fa083bfb | ||
| 6 | + sourceBlobDigest: sha256:eceb178c5d2537e6d21c0461c81f6af1dc245da2c327fdf5305a8191184eff94 | ||
| 7 | 7 | tags: | |
| 8 | 8 | - latest | |
| 9 | - - speakeasy-sdk-regen-1749491200 | ||
| 10 | 9 | Glean Client API: | |
| 11 | 10 | sourceNamespace: glean-client-api | |
| 12 | 11 | sourceRevisionDigest: sha256:4edc63ad559e4f2c9fb9ebf5edaaaaa9269f1874d271cfd84b441d6dacac43d2 | |
@@ -17,10 +16,10 @@ targets: | |||
| 17 | 16 | glean: | |
| 18 | 17 | source: Glean API | |
| 19 | 18 | sourceNamespace: glean-api-specs | |
| 20 | - sourceRevisionDigest: sha256:8a528d68d247ecb98ea1d9d49c135154477cbfbab078b6159359a09f64628fba | ||
| 21 | - sourceBlobDigest: sha256:09d1624a9a347738790040f1fcdc5f2eff15461dd39941a1535efb55e2c8939f | ||
| 19 | + sourceRevisionDigest: sha256:def878110682ba33071e9369f2fc13e9ace94ee3de38b09cbcc5ad93fa083bfb | ||
| 20 | + sourceBlobDigest: sha256:eceb178c5d2537e6d21c0461c81f6af1dc245da2c327fdf5305a8191184eff94 | ||
| 22 | 21 | codeSamplesNamespace: glean-api-specs-python-code-samples | |
| 23 | - codeSamplesRevisionDigest: sha256:d2defba5ce9f2980f4c7a8ed3cd58df2629ca3a2e7c380959c3028c6f231d6ab | ||
| 22 | + codeSamplesRevisionDigest: sha256:8acf66e50535d8fa865214fd70de55e2f04e299bae90925154b6ebb3bbb936c6 | ||
| 24 | 23 | workflow: | |
| 25 | 24 | workflowVersion: 1.0.0 | |
| 26 | 25 | speakeasyVersion: latest | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,6 +49,7 @@ Remember that each namespace requires its own authentication token type as descr | |||
| 49 | 49 | * [SDK Example Usage](#sdk-example-usage) | |
| 50 | 50 | * [Authentication](#authentication) | |
| 51 | 51 | * [Available Resources and Operations](#available-resources-and-operations) | |
| 52 | + * [File uploads](#file-uploads) | ||
| 52 | 53 | * [Retries](#retries) | |
| 53 | 54 | * [Error Handling](#error-handling) | |
| 54 | 55 | * [Server Selection](#server-selection) | |
@@ -141,9 +142,9 @@ import os | |||
| 141 | 142 | ||
| 142 | 143 | with Glean( | |
| 143 | 144 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 144 | - ) as g_client: | ||
| 145 | + ) as glean: | ||
| 145 | 146 | ||
| 146 | - res = g_client.client.chat.create(messages=[ | ||
| 147 | + res = glean.client.chat.create(messages=[ | ||
| 147 | 148 | { | |
| 148 | 149 | "fragments": [ | |
| 149 | 150 | models.ChatMessageFragment( | |
@@ -170,9 +171,9 @@ async def main(): | |||
| 170 | 171 | ||
| 171 | 172 | async with Glean( | |
| 172 | 173 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 173 | - ) as g_client: | ||
| 174 | + ) as glean: | ||
| 174 | 175 | ||
| 175 | - res = await g_client.client.chat.create_async(messages=[ | ||
| 176 | + res = await glean.client.chat.create_async(messages=[ | ||
| 176 | 177 | { | |
| 177 | 178 | "fragments": [ | |
| 178 | 179 | models.ChatMessageFragment( | |
@@ -198,9 +199,9 @@ import os | |||
| 198 | 199 | ||
| 199 | 200 | with Glean( | |
| 200 | 201 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 201 | - ) as g_client: | ||
| 202 | + ) as glean: | ||
| 202 | 203 | ||
| 203 | - res = g_client.client.chat.create_stream(messages=[ | ||
| 204 | + res = glean.client.chat.create_stream(messages=[ | ||
| 204 | 205 | { | |
| 205 | 206 | "fragments": [ | |
| 206 | 207 | models.ChatMessageFragment( | |
@@ -227,9 +228,9 @@ async def main(): | |||
| 227 | 228 | ||
| 228 | 229 | async with Glean( | |
| 229 | 230 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 230 | - ) as g_client: | ||
| 231 | + ) as glean: | ||
| 231 | 232 | ||
| 232 | - res = await g_client.client.chat.create_stream_async(messages=[ | ||
| 233 | + res = await glean.client.chat.create_stream_async(messages=[ | ||
| 233 | 234 | { | |
| 234 | 235 | "fragments": [ | |
| 235 | 236 | models.ChatMessageFragment( | |
@@ -266,9 +267,9 @@ import os | |||
| 266 | 267 | ||
| 267 | 268 | with Glean( | |
| 268 | 269 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 269 | - ) as g_client: | ||
| 270 | + ) as glean: | ||
| 270 | 271 | ||
| 271 | - g_client.client.activity.report(events=[ | ||
| 272 | + glean.client.activity.report(events=[ | ||
| 272 | 273 | { | |
| 273 | 274 | "action": models.ActivityEventAction.HISTORICAL_VIEW, | |
| 274 | 275 | "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 | |||
| 534 | 535 | </details> | |
| 535 | 536 | <!-- End Available Resources and Operations [operations] --> | |
| 536 | 537 | ||
| 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 | + | ||
| 537 | 570 | <!-- Start Retries [retries] --> | |
| 538 | 571 | ## Retries | |
| 539 | 572 | ||
@@ -548,9 +581,9 @@ import os | |||
| 548 | 581 | ||
| 549 | 582 | with Glean( | |
| 550 | 583 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 551 | - ) as g_client: | ||
| 584 | + ) as glean: | ||
| 552 | 585 | ||
| 553 | - g_client.client.activity.report(events=[ | ||
| 586 | + glean.client.activity.report(events=[ | ||
| 554 | 587 | { | |
| 555 | 588 | "action": models.ActivityEventAction.HISTORICAL_VIEW, | |
| 556 | 589 | "timestamp": parse_datetime("2000-01-23T04:56:07.000Z"), | |
@@ -590,9 +623,9 @@ import os | |||
| 590 | 623 | with Glean( | |
| 591 | 624 | retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False), | |
| 592 | 625 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 593 | - ) as g_client: | ||
| 626 | + ) as glean: | ||
| 594 | 627 | ||
| 595 | - g_client.client.activity.report(events=[ | ||
| 628 | + glean.client.activity.report(events=[ | ||
| 596 | 629 | { | |
| 597 | 630 | "action": models.ActivityEventAction.HISTORICAL_VIEW, | |
| 598 | 631 | "timestamp": parse_datetime("2000-01-23T04:56:07.000Z"), | |
@@ -728,9 +761,9 @@ import os | |||
| 728 | 761 | with Glean( | |
| 729 | 762 | instance="<value>" | |
| 730 | 763 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 731 | - ) as g_client: | ||
| 764 | + ) as glean: | ||
| 732 | 765 | ||
| 733 | - g_client.client.activity.report(events=[ | ||
| 766 | + glean.client.activity.report(events=[ | ||
| 734 | 767 | { | |
| 735 | 768 | "action": models.ActivityEventAction.HISTORICAL_VIEW, | |
| 736 | 769 | "timestamp": parse_datetime("2000-01-23T04:56:07.000Z"), | |
@@ -771,9 +804,9 @@ import os | |||
| 771 | 804 | with Glean( | |
| 772 | 805 | server_url="https://instance-name-be.glean.com", | |
| 773 | 806 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 774 | - ) as g_client: | ||
| 807 | + ) as glean: | ||
| 775 | 808 | ||
| 776 | - g_client.client.activity.report(events=[ | ||
| 809 | + glean.client.activity.report(events=[ | ||
| 777 | 810 | { | |
| 778 | 811 | "action": models.ActivityEventAction.HISTORICAL_VIEW, | |
| 779 | 812 | "timestamp": parse_datetime("2000-01-23T04:56:07.000Z"), | |
@@ -898,7 +931,7 @@ def main(): | |||
| 898 | 931 | ||
| 899 | 932 | with Glean( | |
| 900 | 933 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 901 | - ) as g_client: | ||
| 934 | + ) as glean: | ||
| 902 | 935 | # Rest of application here... | |
| 903 | 936 | ||
| 904 | 937 | ||
@@ -907,7 +940,7 @@ async def amain(): | |||
| 907 | 940 | ||
| 908 | 941 | async with Glean( | |
| 909 | 942 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 910 | - ) as g_client: | ||
| 943 | + ) as glean: | ||
| 911 | 944 | # Rest of application here... | |
| 912 | 945 | ``` | |
| 913 | 946 | <!-- End Resource Management [resource-management] --> | |
@@ -923,7 +956,7 @@ from glean.api_client import Glean | |||
| 923 | 956 | import logging | |
| 924 | 957 | ||
| 925 | 958 | logging.basicConfig(level=logging.DEBUG) | |
| 926 | - s = Glean(debug_logger=logging.getLogger("glean")) | ||
| 959 | + s = Glean(debug_logger=logging.getLogger("glean.api_client")) | ||
| 927 | 960 | ``` | |
| 928 | 961 | ||
| 929 | 962 | You can also enable a default debug logger by setting an environment variable `GLEAN_DEBUG` to true. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,9 +7,9 @@ import os | |||
| 7 | 7 | ||
| 8 | 8 | with Glean( | |
| 9 | 9 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 10 | - ) as g_client: | ||
| 10 | + ) as glean: | ||
| 11 | 11 | ||
| 12 | - res = g_client.client.chat.create(messages=[ | ||
| 12 | + res = glean.client.chat.create(messages=[ | ||
| 13 | 13 | { | |
| 14 | 14 | "fragments": [ | |
| 15 | 15 | models.ChatMessageFragment( | |
@@ -36,9 +36,9 @@ async def main(): | |||
| 36 | 36 | ||
| 37 | 37 | async with Glean( | |
| 38 | 38 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 39 | - ) as g_client: | ||
| 39 | + ) as glean: | ||
| 40 | 40 | ||
| 41 | - res = await g_client.client.chat.create_async(messages=[ | ||
| 41 | + res = await glean.client.chat.create_async(messages=[ | ||
| 42 | 42 | { | |
| 43 | 43 | "fragments": [ | |
| 44 | 44 | models.ChatMessageFragment( | |
@@ -62,9 +62,9 @@ import os | |||
| 62 | 62 | ||
| 63 | 63 | with Glean( | |
| 64 | 64 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 65 | - ) as g_client: | ||
| 65 | + ) as glean: | ||
| 66 | 66 | ||
| 67 | - res = g_client.client.chat.create_stream(messages=[ | ||
| 67 | + res = glean.client.chat.create_stream(messages=[ | ||
| 68 | 68 | { | |
| 69 | 69 | "fragments": [ | |
| 70 | 70 | models.ChatMessageFragment( | |
@@ -91,9 +91,9 @@ async def main(): | |||
| 91 | 91 | ||
| 92 | 92 | async with Glean( | |
| 93 | 93 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 94 | - ) as g_client: | ||
| 94 | + ) as glean: | ||
| 95 | 95 | ||
| 96 | - res = await g_client.client.chat.create_stream_async(messages=[ | ||
| 96 | + res = await glean.client.chat.create_stream_async(messages=[ | ||
| 97 | 97 | { | |
| 98 | 98 | "fragments": [ | |
| 99 | 99 | models.ChatMessageFragment( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,4 +10,5 @@ Payload for creating a run. | |||
| 10 | 10 | | `agent_id` | *str* | :heavy_check_mark: | The ID of the agent to run. | | |
| 11 | 11 | | `input` | Dict[str, *Any*] | :heavy_minus_sign: | The input to the agent. | | |
| 12 | 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. | | ||
| 13 | 14 | | `status` | [Optional[models.AgentExecutionStatus]](../models/agentexecutionstatus.md) | :heavy_minus_sign: | The status of the run. One of 'error', 'success'. | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,4 +9,5 @@ Payload for creating a run. | |||
| 9 | 9 | | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | | |
| 10 | 10 | | `agent_id` | *str* | :heavy_check_mark: | The ID of the agent to run. | | |
| 11 | 11 | | `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. | | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,9 +24,9 @@ import os | |||
| 24 | 24 | ||
| 25 | 25 | with Glean( | |
| 26 | 26 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 27 | - ) as g_client: | ||
| 27 | + ) as glean: | ||
| 28 | 28 | ||
| 29 | - res = g_client.client.agents.retrieve(agent_id="<id>") | ||
| 29 | + res = glean.client.agents.retrieve(agent_id="<id>") | ||
| 30 | 30 | ||
| 31 | 31 | # Handle response | |
| 32 | 32 | print(res) | |
@@ -64,9 +64,9 @@ import os | |||
| 64 | 64 | ||
| 65 | 65 | with Glean( | |
| 66 | 66 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 67 | - ) as g_client: | ||
| 67 | + ) as glean: | ||
| 68 | 68 | ||
| 69 | - res = g_client.client.agents.retrieve_schemas(agent_id="<id>") | ||
| 69 | + res = glean.client.agents.retrieve_schemas(agent_id="<id>") | ||
| 70 | 70 | ||
| 71 | 71 | # Handle response | |
| 72 | 72 | print(res) | |
@@ -93,7 +93,7 @@ with Glean( | |||
| 93 | 93 | ||
| 94 | 94 | ## list | |
| 95 | 95 | ||
| 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. | ||
| 97 | 97 | ||
| 98 | 98 | ### Example Usage | |
| 99 | 99 | ||
@@ -104,9 +104,9 @@ import os | |||
| 104 | 104 | ||
| 105 | 105 | with Glean( | |
| 106 | 106 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 107 | - ) as g_client: | ||
| 107 | + ) as glean: | ||
| 108 | 108 | ||
| 109 | - res = g_client.client.agents.list(name="HR Policy Agent") | ||
| 109 | + res = glean.client.agents.list(name="HR Policy Agent") | ||
| 110 | 110 | ||
| 111 | 111 | # Handle response | |
| 112 | 112 | print(res) | |
@@ -143,9 +143,9 @@ import os | |||
| 143 | 143 | ||
| 144 | 144 | with Glean( | |
| 145 | 145 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 146 | - ) as g_client: | ||
| 146 | + ) as glean: | ||
| 147 | 147 | ||
| 148 | - res = g_client.client.agents.run_stream(agent_id="<id>") | ||
| 148 | + res = glean.client.agents.run_stream(agent_id="<id>") | ||
| 149 | 149 | ||
| 150 | 150 | # Handle response | |
| 151 | 151 | print(res) | |
@@ -159,6 +159,7 @@ with Glean( | |||
| 159 | 159 | | `agent_id` | *str* | :heavy_check_mark: | The ID of the agent to run. | | |
| 160 | 160 | | `input` | Dict[str, *Any*] | :heavy_minus_sign: | The input to the agent. | | |
| 161 | 161 | | `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. | | ||
| 162 | 163 | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | |
| 163 | 164 | ||
| 164 | 165 | ### Response | |
@@ -184,9 +185,9 @@ import os | |||
| 184 | 185 | ||
| 185 | 186 | with Glean( | |
| 186 | 187 | api_token=os.getenv("GLEAN_API_TOKEN", ""), | |
| 187 | - ) as g_client: | ||
| 188 | + ) as glean: | ||
| 188 | 189 | ||
| 189 | - res = g_client.client.agents.run(agent_id="<id>") | ||
| 190 | + res = glean.client.agents.run(agent_id="<id>") | ||
| 190 | 191 | ||
| 191 | 192 | # Handle response | |
| 192 | 193 | print(res) | |
@@ -200,6 +201,7 @@ with Glean( | |||
| 200 | 201 | | `agent_id` | *str* | :heavy_check_mark: | The ID of the agent to run. | | |
| 201 | 202 | | `input` | Dict[str, *Any*] | :heavy_minus_sign: | The input to the agent. | | |
| 202 | 203 | | `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. | | ||
| 203 | 205 | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | |
| 204 | 206 | ||
| 205 | 207 | ### Response | |
| Back | FazBrowse Home | New Git URL |
0 commit comments