You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This section outlines how to use the AI DIAL Python client to interact with the DIAL Core API.
44
+
It covers authentication methods, making chat completion requests, working with files, managing applications,
45
+
and utilizing client pools for efficient connection management.
46
+
47
+
### Authentication
48
+
49
+
#### API Keys
28
50
29
51
For authentication with an API key, pass it during the client initialization:
30
52
@@ -66,7 +88,7 @@ async_dial_client = AsyncDial(
66
88
)
67
89
```
68
90
69
-
### Bearer Token
91
+
####Bearer Token
70
92
71
93
You can use a Bearer Token for a token-based authentication of API calls. Client instances will use it to construct the `Authorization` header when making requests:
72
94
@@ -115,7 +137,7 @@ dial_client = Dial(
115
137
)
116
138
```
117
139
118
-
## List Deployments
140
+
###List Deployments
119
141
120
142
If you want to get a list of available deployments, use `client.deployments.list()` or method:
121
143
@@ -128,9 +150,9 @@ If you want to get a list of available deployments, use `client.deployments.list
128
150
]
129
151
```
130
152
131
-
## Make Completions Requests
153
+
###Make Completions Requests
132
154
133
-
### Without Streaming
155
+
####Without Streaming
134
156
135
157
Synchronous:
136
158
@@ -203,7 +225,7 @@ ChatCompletionResponse(
203
225
)
204
226
```
205
227
206
-
### With Streaming
228
+
####With Streaming
207
229
208
230
Synchronous:
209
231
@@ -304,9 +326,9 @@ ChatCompletionChunk(
304
326
)
305
327
```
306
328
307
-
## Working with Files
329
+
###Working with Files
308
330
309
-
### Working with URLs
331
+
####Working with URLs
310
332
311
333
Files are AI DIAL resources that operate with URL-like objects. Use `pathlib.PurePosixPath` or `str` to create to create new URL-like objects or to get a `string` representation of them.
As a result, you will receive a list of `Application` objects. Refer to the [previous example](#list-applications).
516
538
517
-
## Client Pool
539
+
###Client Pool
518
540
519
541
When you need to create multiple DIAL clients and wish to enhance performance by reusing the HTTP connection for the same DIAL instance, consider using synchronous and asynchronous **client pools**.
0 commit comments