Skip to content

Commit 536d5da

Browse files
friendli-botseuha516github-actions[bot]
committed
Update 2025-05-28 (friendliai#60)
fix Co-Authored-By: Seungha Jeon <seungha@friendli.ai> Co-Authored-By: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent aa12d53 commit 536d5da

418 files changed

Lines changed: 14936 additions & 2934 deletions

File tree

Some content is hidden

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

.genignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
src/friendli/utils/annotations.py
1+
src/friendli_core/utils/annotations.py
22
scripts/prepare_readme.py
3+
pyproject.toml

.speakeasy/gen.lock

Lines changed: 494 additions & 261 deletions
Large diffs are not rendered by default.

.speakeasy/gen.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
configVersion: 2.0.0
22
generation:
3-
sdkClassName: Friendli
3+
sdkClassName: FriendliCore
44
maintainOpenAPIOrder: true
55
usageSnippets:
66
optionalPropertyRendering: withExample
@@ -15,7 +15,7 @@ generation:
1515
oAuth2ClientCredentialsEnabled: true
1616
oAuth2PasswordEnabled: true
1717
python:
18-
version: 0.7.4
18+
version: 0.9.0
1919
additionalDependencies:
2020
dev: {}
2121
main: {}

.speakeasy/workflow.lock

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
speakeasyVersion: 1.517.3
1+
speakeasyVersion: 1.535.1
22
sources:
33
Friendli-API-Schema:
44
sourceNamespace: friendli-api-schema
5-
sourceRevisionDigest: sha256:2a769cea8abb93efd02b2c5bfcccf6bd690ddfbd9d5bda2184c2bd54df40cfb0
6-
sourceBlobDigest: sha256:8a23f52193709f8f36ee1f4788d9b92e1862e51f1252e3edc91acb396f3a752f
5+
sourceRevisionDigest: sha256:f286fddced85b1bc7a5d5d896984808762eadffc857eb99f2421ccbaf2ff475e
6+
sourceBlobDigest: sha256:198d668ecb6178ba1b89f7e246233cc7a91866d6eb032b0955c3700133f1e230
77
tags:
88
- latest
9-
- speakeasy-sdk-regen-1741924776
9+
- speakeasy-sdk-regen-1744933798
1010
targets:
1111
friendli:
1212
source: Friendli-API-Schema
1313
sourceNamespace: friendli-api-schema
14-
sourceRevisionDigest: sha256:2a769cea8abb93efd02b2c5bfcccf6bd690ddfbd9d5bda2184c2bd54df40cfb0
15-
sourceBlobDigest: sha256:8a23f52193709f8f36ee1f4788d9b92e1862e51f1252e3edc91acb396f3a752f
16-
codeSamplesNamespace: friendli-api-schema-code-samples
17-
codeSamplesRevisionDigest: sha256:bd1be131e3a010218f4ebec6a659fe06f924af4eb92c1c630de974941e0bb58c
14+
sourceRevisionDigest: sha256:f286fddced85b1bc7a5d5d896984808762eadffc857eb99f2421ccbaf2ff475e
15+
sourceBlobDigest: sha256:198d668ecb6178ba1b89f7e246233cc7a91866d6eb032b0955c3700133f1e230
1816
workflow:
1917
workflowVersion: 1.0.0
2018
speakeasyVersion: latest
@@ -28,10 +26,10 @@ workflow:
2826
friendli:
2927
target: python
3028
source: Friendli-API-Schema
31-
publish:
32-
pypi:
33-
token: $pypi_token
34-
codeSamples:
35-
registry:
36-
location: registry.speakeasyapi.dev/friendliai/friendliai/friendli-api-schema-code-samples
37-
blocking: false
29+
publish:
30+
pypi:
31+
token: $pypi_token
32+
codeSamples:
33+
registry:
34+
location: registry.speakeasyapi.dev/friendliai/friendliai/friendli-api-schema-code-samples
35+
blocking: false

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"python.testing.pytestArgs": ["tests", "-vv"],
33
"python.testing.unittestEnabled": false,
44
"python.testing.pytestEnabled": true,
5-
"pylint.args": ["--rcfile=pylintrc"]
5+
"pylint.args": ["--rcfile=pylintrc"],
6+
"editor.formatOnSave": false
67
}

README.md

Lines changed: 102 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
## Token Setup
1010

11-
When using Friendli Python SDK, you need to provide a Friendli Token for authentication and authorization purposes. A Friendli Token serves as an alternative method of authorization to signing in with an email and a password. You can generate a new Friendli Token through the [Friendli Suite](https://suite.friendli.ai), at your "Personal settings" page by following the steps below.
11+
When using Friendli Python SDK, you need to provide a Friendli Token for authentication and authorization purposes. A Friendli Token serves as an alternative method of authorization to signing in with an email and a password. You can generate a new Friendli Token through the [Friendli Suite](https://friendli.ai/suite), at your "Personal settings" page by following the steps below.
1212

13-
1. Go to the [Friendli Suite](https://suite.friendli.ai) and sign in with your account.
13+
1. Go to the [Friendli Suite](https://friendli.ai/suite) and sign in with your account.
1414
2. Click the profile icon at the top-right corner of the page.
1515
3. Click "Personal settings" menu.
1616
4. Go to the "Tokens" tab on the navigation bar.
@@ -29,6 +29,7 @@ When using Friendli Python SDK, you need to provide a Friendli Token for authent
2929
* [Authentication](#authentication)
3030
* [Available Resources and Operations](#available-resources-and-operations)
3131
* [Server-sent event streaming](#server-sent-event-streaming)
32+
* [File uploads](#file-uploads)
3233
* [Retries](#retries)
3334
* [Error Handling](#error-handling)
3435
* [Server Selection](#server-selection)
@@ -42,6 +43,10 @@ When using Friendli Python SDK, you need to provide a Friendli Token for authent
4243
<!-- Start SDK Installation [installation] -->
4344
## SDK Installation
4445

46+
> [!TIP]
47+
> To finish publishing your SDK to PyPI you must [run your first generation action](https://www.speakeasy.com/docs/github-setup#step-by-step-guide).
48+
49+
4550
> [!NOTE]
4651
> **Python version upgrade policy**
4752
>
@@ -84,6 +89,7 @@ It's also possible to write a standalone Python script without needing to set up
8489
# ]
8590
# ///
8691

92+
8793
from friendli import SyncFriendli
8894

8995
sdk = SyncFriendli(
@@ -106,6 +112,7 @@ Given a list of messages forming a conversation, the model generates a response.
106112

107113
```python
108114
# Synchronous Example
115+
109116
import os
110117

111118
from friendli import SyncFriendli
@@ -175,6 +182,7 @@ Given a list of messages forming a conversation, the model generates a response.
175182

176183
```python
177184
# Synchronous Example
185+
178186
import os
179187

180188
from friendli import SyncFriendli
@@ -290,47 +298,73 @@ with SyncFriendli(
290298
### [container](docs/sdks/container/README.md)
291299

292300

293-
#### [container.chat](docs/sdks/friendlicontainerchat/README.md)
301+
#### [container.chat](docs/sdks/friendlicorecontainerchat/README.md)
302+
303+
* [complete](docs/sdks/friendlicorecontainerchat/README.md#complete) - Chat completions
304+
* [stream](docs/sdks/friendlicorecontainerchat/README.md#stream) - Stream chat completions
294305

295-
* [complete](docs/sdks/friendlicontainerchat/README.md#complete) - Chat completions
296-
* [stream](docs/sdks/friendlicontainerchat/README.md#stream) - Stream chat completions
306+
#### [container.completions](docs/sdks/friendlicorecontainercompletions/README.md)
297307

298-
#### [container.completions](docs/sdks/friendlicontainercompletions/README.md)
308+
* [complete](docs/sdks/friendlicorecontainercompletions/README.md#complete) - Completions
309+
* [stream](docs/sdks/friendlicorecontainercompletions/README.md#stream) - Stream completions
299310

300-
* [complete](docs/sdks/friendlicontainercompletions/README.md#complete) - Completions
301-
* [stream](docs/sdks/friendlicontainercompletions/README.md#stream) - Stream completions
311+
#### [container.image](docs/sdks/friendlicoreimage/README.md)
302312

303-
#### [container.token](docs/sdks/friendlicontainertoken/README.md)
313+
* [generate](docs/sdks/friendlicoreimage/README.md#generate) - Image generations
304314

305-
* [tokenization](docs/sdks/friendlicontainertoken/README.md#tokenization) - Tokenization
306-
* [detokenization](docs/sdks/friendlicontainertoken/README.md#detokenization) - Detokenization
315+
#### [container.token](docs/sdks/friendlicorecontainertoken/README.md)
316+
317+
* [tokenization](docs/sdks/friendlicorecontainertoken/README.md#tokenization) - Tokenization
318+
* [detokenization](docs/sdks/friendlicorecontainertoken/README.md#detokenization) - Detokenization
307319

308320
### [dedicated](docs/sdks/dedicated/README.md)
309321

310322

311-
#### [dedicated.chat](docs/sdks/friendlichat/README.md)
323+
#### [dedicated.chat](docs/sdks/friendlicorechat/README.md)
312324

313-
* [complete](docs/sdks/friendlichat/README.md#complete) - Chat completions
314-
* [stream](docs/sdks/friendlichat/README.md#stream) - Stream chat completions
325+
* [complete](docs/sdks/friendlicorechat/README.md#complete) - Chat completions
326+
* [stream](docs/sdks/friendlicorechat/README.md#stream) - Stream chat completions
315327

316-
#### [dedicated.completions](docs/sdks/friendlicompletions/README.md)
328+
#### [dedicated.completions](docs/sdks/friendlicorecompletions/README.md)
317329

318-
* [complete](docs/sdks/friendlicompletions/README.md#complete) - Completions
319-
* [stream](docs/sdks/friendlicompletions/README.md#stream) - Stream completions
330+
* [complete](docs/sdks/friendlicorecompletions/README.md#complete) - Completions
331+
* [stream](docs/sdks/friendlicorecompletions/README.md#stream) - Stream completions
320332

321333
#### [dedicated.endpoint](docs/sdks/endpoint/README.md)
322334

323335
* [wandb_artifact_create](docs/sdks/endpoint/README.md#wandb_artifact_create) - Create endpoint from W&B artifact
336+
* [create](docs/sdks/endpoint/README.md#create) - Create a new endpoint
337+
* [list](docs/sdks/endpoint/README.md#list) - List all endpoints
338+
* [get](docs/sdks/endpoint/README.md#get) - Get endpoint specification
339+
* [update](docs/sdks/endpoint/README.md#update) - Update endpoint spec
340+
* [delete](docs/sdks/endpoint/README.md#delete) - Delete endpoint
341+
* [get_version](docs/sdks/endpoint/README.md#get_version) - Get endpoint versions
342+
* [get_status](docs/sdks/endpoint/README.md#get_status) - Get endpoint status
343+
* [sleep](docs/sdks/endpoint/README.md#sleep) - Sleep endpoint
344+
* [wake](docs/sdks/endpoint/README.md#wake) - Wake endpoint
345+
* [terminate](docs/sdks/endpoint/README.md#terminate) - Terminate endpoint
346+
* [restart](docs/sdks/endpoint/README.md#restart) - Restart endpoint
324347

325348
#### [dedicated.image](docs/sdks/image/README.md)
326349

327350
* [generate](docs/sdks/image/README.md#generate) - Image generations
328351

329-
#### [dedicated.token](docs/sdks/friendlitoken/README.md)
352+
#### [dedicated.token](docs/sdks/friendlicoretoken/README.md)
353+
354+
* [tokenization](docs/sdks/friendlicoretoken/README.md#tokenization) - Tokenization
355+
* [detokenization](docs/sdks/friendlicoretoken/README.md#detokenization) - Detokenization
356+
357+
358+
### [platform](docs/sdks/platform/README.md)
359+
330360

331-
* [tokenization](docs/sdks/friendlitoken/README.md#tokenization) - Tokenization
332-
* [detokenization](docs/sdks/friendlitoken/README.md#detokenization) - Detokenization
361+
#### [platform.files](docs/sdks/files/README.md)
333362

363+
* [upload](docs/sdks/files/README.md#upload) - Files upload
364+
* [list](docs/sdks/files/README.md#list) - Files list
365+
* [retrieve](docs/sdks/files/README.md#retrieve) - File retrieve
366+
* [delete](docs/sdks/files/README.md#delete) - Files delete
367+
* [download](docs/sdks/files/README.md#download) - Files download
334368

335369
### [serverless](docs/sdks/serverless/README.md)
336370

@@ -412,6 +446,37 @@ with SyncFriendli(
412446
[context-manager]: https://book.pythontips.com/en/latest/context_managers.html
413447
<!-- End Server-sent event streaming [eventstream] -->
414448

449+
<!-- Start File uploads [file-upload] -->
450+
## File uploads
451+
452+
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.
453+
454+
> [!TIP]
455+
>
456+
> For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files.
457+
>
458+
459+
```python
460+
import os
461+
462+
from friendli import SyncFriendli
463+
464+
with SyncFriendli(
465+
token=os.getenv("FRIENDLI_TOKEN", ""),
466+
) as friendli:
467+
res = friendli.platform.files.upload(
468+
file={
469+
"file_name": "example.file",
470+
"content": open("example.file", "rb"),
471+
},
472+
purpose="batch",
473+
)
474+
475+
# Handle response
476+
print(res)
477+
```
478+
<!-- End File uploads [file-upload] -->
479+
415480
<!-- Start Retries [retries] -->
416481
## Retries
417482

@@ -492,11 +557,12 @@ By default, an API error will raise a models.SDKError exception, which has the f
492557
| `.raw_response` | *httpx.Response* | The raw HTTP response |
493558
| `.body` | *str* | The response content |
494559

495-
When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `complete` method may raise the following exceptions:
560+
When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `create` method may raise the following exceptions:
496561

497-
| Error Type | Status Code | Content Type |
498-
| --------------- | ----------- | ------------ |
499-
| models.SDKError | 4XX, 5XX | \*/\* |
562+
| Error Type | Status Code | Content Type |
563+
| -------------------------- | ----------- | ---------------- |
564+
| models.HTTPValidationError | 422 | application/json |
565+
| models.SDKError | 4XX, 5XX | \*/\* |
500566

501567
### Example
502568

@@ -510,24 +576,23 @@ with SyncFriendli(
510576
) as friendli:
511577
res = None
512578
try:
513-
res = friendli.serverless.chat.complete(
514-
messages=[
515-
{
516-
"content": "You are a helpful assistant.",
517-
"role": "system",
518-
},
519-
{
520-
"content": "Hello!",
521-
"role": "user",
522-
},
523-
],
524-
model="meta-llama-3.1-8b-instruct",
525-
max_tokens=200,
579+
res = friendli.dedicated.endpoint.create(
580+
advanced={
581+
"tokenizer_add_special_tokens": True,
582+
"tokenizer_skip_special_tokens": False,
583+
},
584+
hf_model_repo="<value>",
585+
instance_option_id="<id>",
586+
name="<value>",
587+
project_id="<id>",
526588
)
527589

528590
# Handle response
529591
print(res)
530592

593+
except models.HTTPValidationError as e:
594+
# handle e.data: models.HTTPValidationErrorData
595+
raise (e)
531596
except models.SDKError as e:
532597
# handle exception
533598
raise (e)

RELEASES.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,40 @@ Based on:
8989
### Generated
9090
- [python v0.7.4] .
9191
### Releases
92-
- [PyPI v0.7.4] https://pypi.org/project/friendli/0.7.4 - .
92+
- [PyPI v0.7.4] https://pypi.org/project/friendli/0.7.4 - .
93+
94+
## 2025-03-14 07:40:14
95+
### Changes
96+
Based on:
97+
- OpenAPI Doc
98+
- Speakeasy CLI 1.517.3 (2.548.6) https://github.com/speakeasy-api/speakeasy
99+
### Generated
100+
- [python v0.7.5] .
101+
### Releases
102+
- [PyPI v0.7.5] https://pypi.org/project/friendli/0.7.5 - .
103+
104+
## 2025-03-24 04:41:54
105+
### Changes
106+
Based on:
107+
- OpenAPI Doc
108+
- Speakeasy CLI 1.523.0 (2.559.0) https://github.com/speakeasy-api/speakeasy
109+
### Generated
110+
- [python v0.8.0] .
111+
### Releases
112+
- [PyPI v0.8.0] https://pypi.org/project/friendli/0.8.0 - .
113+
114+
## 2025-04-01 05:11:31
115+
### Changes
116+
Based on:
117+
- OpenAPI Doc
118+
- Speakeasy CLI 1.526.6 (2.563.1) https://github.com/speakeasy-api/speakeasy
119+
### Generated
120+
- [python v0.8.1] .
121+
122+
## 2025-04-17 23:49:40
123+
### Changes
124+
Based on:
125+
- OpenAPI Doc
126+
- Speakeasy CLI 1.535.1 (2.585.2) https://github.com/speakeasy-api/speakeasy
127+
### Generated
128+
- [python v0.9.0] .

USAGE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Given a list of messages forming a conversation, the model generates a response.
55

66
```python
77
# Synchronous Example
8+
89
import os
910

1011
from friendli import SyncFriendli
@@ -74,6 +75,7 @@ Given a list of messages forming a conversation, the model generates a response.
7475

7576
```python
7677
# Synchronous Example
78+
7779
import os
7880

7981
from friendli import SyncFriendli

0 commit comments

Comments
 (0)