@@ -13,16 +13,12 @@ This guide shows you how to authenticate and configure the AsyncDeepsetClient fo
1313** Using environment variables (recommended):**
1414
1515``` python
16- import asyncio
1716from deepset_mcp.api import AsyncDeepsetClient
1817
19- async def main ():
20- # Reads DEEPSET_API_KEY from environment
21- async with AsyncDeepsetClient() as client:
22- workspaces = await client.workspaces().list()
23- print (f " Available workspaces: { len (workspaces.data)} " )
24-
25- asyncio.run(main())
18+ # Reads DEEPSET_API_KEY from environment
19+ async with AsyncDeepsetClient() as client:
20+ workspaces = await client.workspaces().list()
21+ print (f " Available workspaces: { len (workspaces)} " )
2622```
2723
2824** Providing credentials directly:**
@@ -185,7 +181,7 @@ async with AsyncDeepsetClient() as client:
185181
186182 # List all workspaces
187183 workspaces = await workspaces_client.list()
188- for workspace in workspaces.data :
184+ for workspace in workspaces:
189185 print (f " Workspace: { workspace.name} (ID: { workspace.workspace_id} ) " )
190186
191187 # Use workspace-specific resources
@@ -382,6 +378,24 @@ async with AsyncDeepsetClient() as client:
382378 print (f " [ { log_entry.timestamp} ] { log_entry.level} : { log_entry.message} " )
383379```
384380
381+ ### How to Use in Synchronous Environments
382+
383+ This guide shows how to make API requests through the client in synchronous contexts.
384+
385+ ``` python
386+ import asyncio
387+ from deepset_mcp.api import AsyncDeepsetClient
388+
389+ client = AsyncDeepsetClient()
390+ pipelines = client.pipelines(" my-workspace" )
391+ my_pipeline = asyncio.run(pipelines.get(" my-pipeline" ))
392+
393+ valid = asyncio.run(pipelines.validate(my_pipeline.yaml_config))
394+
395+ if valid.valid:
396+ print (" The pipeline is valid!" )
397+ ```
398+
385399
386400## Concepts
387401
0 commit comments