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
39 changes: 20 additions & 19 deletions .speakeasy/gen.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ generation:
generateNewTests: true
skipResponseBodyAssertions: true
python:
version: 0.4.1
version: 0.4.2
additionalDependencies:
dev: {}
main: {}
Expand Down
1 change: 0 additions & 1 deletion .speakeasy/glean-merged-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ servers:
description: The instance name (typically the email domain without the TLD) that determines the deployment backend.
security:
- APIToken: []
- cookieAuth: []
paths:
/rest/api/v1/activity:
post:
Expand Down
14 changes: 7 additions & 7 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
speakeasyVersion: 1.546.1
speakeasyVersion: 1.546.2
sources:
Glean API:
sourceNamespace: glean-api-specs
sourceRevisionDigest: sha256:81bbab1ab458be7ad4d3b4e052629504f2dc32e0554426fc4bac347061fad35c
sourceBlobDigest: sha256:f2a2721aa0c1960218fc0a261ef3f689e2e78c399b36b7e6602e6ad8650206ac
sourceRevisionDigest: sha256:d6fa8702a32b71122384445deea1072af1cf22ed50c70ffc25cc87a25fc82612
sourceBlobDigest: sha256:393fd23b9e5d6d5f6929f86557b6b42c770f61271257cd10bc6a364b3ac8b053
tags:
- latest
- speakeasy-sdk-regen-1747427742
- speakeasy-sdk-regen-1747525127
Glean Client API:
sourceNamespace: glean-client-api
sourceRevisionDigest: sha256:4edc63ad559e4f2c9fb9ebf5edaaaaa9269f1874d271cfd84b441d6dacac43d2
Expand All @@ -17,10 +17,10 @@ targets:
glean:
source: Glean API
sourceNamespace: glean-api-specs
sourceRevisionDigest: sha256:81bbab1ab458be7ad4d3b4e052629504f2dc32e0554426fc4bac347061fad35c
sourceBlobDigest: sha256:f2a2721aa0c1960218fc0a261ef3f689e2e78c399b36b7e6602e6ad8650206ac
sourceRevisionDigest: sha256:d6fa8702a32b71122384445deea1072af1cf22ed50c70ffc25cc87a25fc82612
sourceBlobDigest: sha256:393fd23b9e5d6d5f6929f86557b6b42c770f61271257cd10bc6a364b3ac8b053
codeSamplesNamespace: glean-api-specs-python-code-samples
codeSamplesRevisionDigest: sha256:77c663e0da7182a41d5bfbf2d40c5c3c5510eaade3541631d7ecacbbb2ec31bd
codeSamplesRevisionDigest: sha256:f98f110acb5e1a433c37aaae9c4c266b24433af86955a9708d22948caf79f6de
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
57 changes: 17 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ import os


with Glean(
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

res = g_client.client.chat.create(messages=[
Expand Down Expand Up @@ -172,9 +170,7 @@ import os
async def main():

async with Glean(
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

res = await g_client.client.chat.create_async(messages=[
Expand Down Expand Up @@ -202,9 +198,7 @@ import os


with Glean(
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

res = g_client.client.chat.create_stream(messages=[
Expand Down Expand Up @@ -233,9 +227,7 @@ import os
async def main():

async with Glean(
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

res = await g_client.client.chat.create_stream_async(messages=[
Expand All @@ -260,24 +252,21 @@ asyncio.run(main())

### Per-Client Security Schemes

This SDK supports the following security schemes globally:
This SDK supports the following security scheme globally:

| Name | Type | Scheme | Environment Variable |
| ------------- | ------ | ----------- | -------------------- |
| `api_token` | http | HTTP Bearer | `GLEAN_API_TOKEN` |
| `cookie_auth` | apiKey | API key | `GLEAN_COOKIE_AUTH` |
| Name | Type | Scheme | Environment Variable |
| ----------- | ---- | ----------- | -------------------- |
| `api_token` | http | HTTP Bearer | `GLEAN_API_TOKEN` |

You can set the security parameters through the `security` optional parameter when initializing the SDK client instance. The selected scheme will be used by default to authenticate with the API for all operations that support it. For example:
To authenticate with the API the `api_token` parameter must be set when initializing the SDK client instance. For example:
```python
from glean import Glean, models
from glean.utils import parse_datetime
import os


with Glean(
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

g_client.client.activity.report(events=[
Expand Down Expand Up @@ -561,9 +550,7 @@ import os


with Glean(
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

g_client.client.activity.report(events=[
Expand Down Expand Up @@ -605,9 +592,7 @@ import os

with Glean(
retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

g_client.client.activity.report(events=[
Expand Down Expand Up @@ -745,9 +730,7 @@ import os

with Glean(
instance="<value>"
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

g_client.client.activity.report(events=[
Expand Down Expand Up @@ -790,9 +773,7 @@ import os

with Glean(
server_url="https://instance-name-be.glean.com",
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

g_client.client.activity.report(events=[
Expand Down Expand Up @@ -914,14 +895,12 @@ The `Glean` class implements the context manager protocol and registers a finali
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers

```python
from glean import Glean, models
from glean import Glean
import os
def main():

with Glean(
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:
# Rest of application here...

Expand All @@ -930,9 +909,7 @@ def main():
async def amain():

async with Glean(
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:
# Rest of application here...
```
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,14 @@ Based on:
### Generated
- [python v0.4.1] .
### Releases
- [PyPI v0.4.1] https://pypi.org/project/glean/0.4.1 - .
- [PyPI v0.4.1] https://pypi.org/project/glean/0.4.1 - .

## 2025-05-17 23:38:28
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.546.2 (2.604.4) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v0.4.2] .
### Releases
- [PyPI v0.4.2] https://pypi.org/project/glean/0.4.2 - .
16 changes: 4 additions & 12 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import os


with Glean(
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

res = g_client.client.chat.create(messages=[
Expand Down Expand Up @@ -37,9 +35,7 @@ import os
async def main():

async with Glean(
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

res = await g_client.client.chat.create_async(messages=[
Expand All @@ -65,9 +61,7 @@ import os


with Glean(
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

res = g_client.client.chat.create_stream(messages=[
Expand Down Expand Up @@ -96,9 +90,7 @@ import os
async def main():

async with Glean(
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

res = await g_client.client.chat.create_stream_async(messages=[
Expand Down
3 changes: 1 addition & 2 deletions docs/models/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@

| Field | Type | Required | Description |
| ------------------ | ------------------ | ------------------ | ------------------ |
| `api_token` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `cookie_auth` | *Optional[str]* | :heavy_minus_sign: | N/A |
| `api_token` | *Optional[str]* | :heavy_minus_sign: | N/A |
30 changes: 10 additions & 20 deletions docs/sdks/agents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ Get an agent by ID. This endpoint implements the LangChain Agent Protocol, speci
### Example Usage

```python
from glean import Glean, models
from glean import Glean
import os


with Glean(
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

res = g_client.client.agents.retrieve(agent_id="<id>")
Expand Down Expand Up @@ -60,14 +58,12 @@ Get an agent's schemas by ID. This endpoint implements the LangChain Agent Proto
### Example Usage

```python
from glean import Glean, models
from glean import Glean
import os


with Glean(
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

res = g_client.client.agents.retrieve_schemas(agent_id="<id>")
Expand Down Expand Up @@ -102,14 +98,12 @@ List Agents available in this service. This endpoint implements the LangChain Ag
### Example Usage

```python
from glean import Glean, models
from glean import Glean
import os


with Glean(
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

res = g_client.client.agents.list()
Expand Down Expand Up @@ -143,14 +137,12 @@ Creates and triggers a run of an agent. Streams the output in SSE format. This e
### Example Usage

```python
from glean import Glean, models
from glean import Glean
import os


with Glean(
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

res = g_client.client.agents.run_stream()
Expand Down Expand Up @@ -184,14 +176,12 @@ Creates and triggers a run of an agent. Waits for final output and then returns
### Example Usage

```python
from glean import Glean, models
from glean import Glean
import os


with Glean(
security=models.Security(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
),
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:

res = g_client.client.agents.run()
Expand Down
Loading