Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: 🐝 Update SDK - Generate MISTRALAI MISTRALAI-SDK 1.2.0 #153

Merged
merged 4 commits into from
Nov 7, 2024
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
150 changes: 123 additions & 27 deletions .speakeasy/gen.lock

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ generation:
requestResponseComponentNamesFeb2024: true
auth:
oAuth2ClientCredentialsEnabled: true
oAuth2PasswordEnabled: false
python:
version: 1.1.0
version: 1.2.0
additionalDependencies:
dev:
pytest: ^8.2.2
Expand All @@ -23,8 +24,11 @@ python:
description: Python Client SDK for the Mistral AI API.
enumFormat: union
envVarPrefix: MISTRAL
fixFlags:
responseRequiredSep2024: false
flattenGlobalSecurity: true
flattenRequests: true
flatteningOrder: parameters-first
imports:
option: openapi
paths:
Expand All @@ -34,7 +38,7 @@ python:
shared: ""
webhooks: ""
inputModelSuffix: input
maxMethodParams: 4
maxMethodParams: 15
methodArguments: infer-optional-args
outputModelSuffix: output
packageName: mistralai
Expand Down
52 changes: 33 additions & 19 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,58 +1,60 @@
speakeasyVersion: 1.398.0
speakeasyVersion: 1.434.4
sources:
mistral-azure-source:
sourceNamespace: mistral-openapi-azure
sourceRevisionDigest: sha256:4e9539e6903e630aa69e48af190a24d3702f6038c7b7a92472c7942597c2a6f5
sourceBlobDigest: sha256:3ace0709471c04a040c9763097fef0081d6c21a1be0b694dfe5991c045b76d18
sourceRevisionDigest: sha256:8fda8235e30128cc8e1c4e1b828316551d03b584568789f262dc287b81d584ee
sourceBlobDigest: sha256:3c039e1f8a2230a86b0e1acec6224f6b8d6f181fb222b6b3b39d38b52075a8ec
tags:
- latest
mistral-google-cloud-source:
sourceNamespace: mistral-openapi-google-cloud
sourceRevisionDigest: sha256:3047ad3ff8797fded89618b375d1398d48924a3a5f9ea1000c4284a110567c43
sourceBlobDigest: sha256:02bbcef310f965d7ad089fb46d57b39f45b47cbc8f5cf90f728db03e960bdbca
sourceRevisionDigest: sha256:b2ce8e0e63674ea7ccfa3a75ff231bb97a39748331bcc0a3629f29c158f5b31e
sourceBlobDigest: sha256:a895adbf903776492b28daa3dd8c624f509decbbfe9ca6cda6510a33226604be
tags:
- latest
mistral-openapi:
sourceNamespace: mistral-openapi
sourceRevisionDigest: sha256:8e2d62b2242960d958406ba266eda41a013c1459dbac67195f8e2662c04cd05f
sourceBlobDigest: sha256:9fbff48fe087e3b2f950b1cfa52b6a25143982741dc7e6750dd14d9c5bed4041
sourceRevisionDigest: sha256:e658442ebfc83351cbb7873fb17b03f07ff9edebd8eddfce5577e2c5c7bfafce
sourceBlobDigest: sha256:559403eaaa97c021eaf0022adddb1066694d879a946c87057e942806d5a2a2a2
tags:
- latest
targets:
mistralai-azure-sdk:
source: mistral-azure-source
sourceNamespace: mistral-openapi-azure
sourceRevisionDigest: sha256:4e9539e6903e630aa69e48af190a24d3702f6038c7b7a92472c7942597c2a6f5
sourceBlobDigest: sha256:3ace0709471c04a040c9763097fef0081d6c21a1be0b694dfe5991c045b76d18
sourceRevisionDigest: sha256:8fda8235e30128cc8e1c4e1b828316551d03b584568789f262dc287b81d584ee
sourceBlobDigest: sha256:3c039e1f8a2230a86b0e1acec6224f6b8d6f181fb222b6b3b39d38b52075a8ec
mistralai-gcp-sdk:
source: mistral-google-cloud-source
sourceNamespace: mistral-openapi-google-cloud
sourceRevisionDigest: sha256:3047ad3ff8797fded89618b375d1398d48924a3a5f9ea1000c4284a110567c43
sourceBlobDigest: sha256:02bbcef310f965d7ad089fb46d57b39f45b47cbc8f5cf90f728db03e960bdbca
sourceRevisionDigest: sha256:b2ce8e0e63674ea7ccfa3a75ff231bb97a39748331bcc0a3629f29c158f5b31e
sourceBlobDigest: sha256:a895adbf903776492b28daa3dd8c624f509decbbfe9ca6cda6510a33226604be
mistralai-sdk:
source: mistral-openapi
sourceNamespace: mistral-openapi
sourceRevisionDigest: sha256:8e2d62b2242960d958406ba266eda41a013c1459dbac67195f8e2662c04cd05f
sourceBlobDigest: sha256:9fbff48fe087e3b2f950b1cfa52b6a25143982741dc7e6750dd14d9c5bed4041
sourceRevisionDigest: sha256:e658442ebfc83351cbb7873fb17b03f07ff9edebd8eddfce5577e2c5c7bfafce
sourceBlobDigest: sha256:559403eaaa97c021eaf0022adddb1066694d879a946c87057e942806d5a2a2a2
codeSamplesNamespace: mistral-openapi-code-samples
codeSamplesRevisionDigest: sha256:e56faedc510d1c011d19e5fbbaa9d41917ffd6c22833b0795a61aa6da1cbca9b
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
mistral-azure-source:
inputs:
- location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-azure
- location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-azure:main
registry:
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-azure
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-azure:main
mistral-google-cloud-source:
inputs:
- location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-google-cloud
- location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-google-cloud:main
registry:
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-google-cloud
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-google-cloud:main
mistral-openapi:
inputs:
- location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi
- location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi:main
registry:
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi:main
targets:
mistralai-azure-sdk:
target: python
Expand All @@ -61,16 +63,28 @@ workflow:
publish:
pypi:
token: $pypi_token
codeSamples:
registry:
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-azure-code-samples
blocking: false
mistralai-gcp-sdk:
target: python
source: mistral-google-cloud-source
output: ./packages/mistralai_gcp
publish:
pypi:
token: $pypi_token
codeSamples:
registry:
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-google-cloud-code-samples
blocking: false
mistralai-sdk:
target: python
source: mistral-openapi
publish:
pypi:
token: $pypi_token
codeSamples:
registry:
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-code-samples
blocking: false
12 changes: 12 additions & 0 deletions .speakeasy/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,28 @@ targets:
publish:
pypi:
token: $pypi_token
codeSamples:
registry:
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-azure-code-samples
blocking: false
mistralai-gcp-sdk:
target: python
source: mistral-google-cloud-source
output: ./packages/mistralai_gcp
publish:
pypi:
token: $pypi_token
codeSamples:
registry:
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-google-cloud-code-samples
blocking: false
mistralai-sdk:
target: python
source: mistral-openapi
publish:
pypi:
token: $pypi_token
codeSamples:
registry:
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-code-samples
blocking: false
101 changes: 88 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ s = Mistral(

res = s.agents.complete(messages=[
{
"content": "<value>",
"content": "Who is the best French painter? Answer in one short sentence.",
"role": "user",
},
], agent_id="<value>")

Expand Down Expand Up @@ -212,6 +213,53 @@ async def main():
# handle response
pass

asyncio.run(main())
```

### Create Embedding Request

This example shows how to create embedding request.

```python
# Synchronous Example
from mistralai import Mistral
import os

s = Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
)

res = s.embeddings.create(inputs=[
"Embed this sentence.",
"As well as this one.",
], model="Wrangler")

if res is not None:
# handle response
pass
```

</br>

The same SDK client can also be used to make asychronous requests by importing asyncio.
```python
# Asynchronous Example
import asyncio
from mistralai import Mistral
import os

async def main():
s = Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
)
res = await s.embeddings.create_async(inputs=[
"Embed this sentence.",
"As well as this one.",
], model="Wrangler")
if res is not None:
# handle response
pass

asyncio.run(main())
```
<!-- End SDK Example Usage [usage] -->
Expand Down Expand Up @@ -322,11 +370,26 @@ The documentation for the GCP SDK is available [here](packages/mistralai_gcp/REA
* [complete](docs/sdks/agents/README.md#complete) - Agents Completion
* [stream](docs/sdks/agents/README.md#stream) - Stream Agents completion

### [batch](docs/sdks/batch/README.md)


#### [batch.jobs](docs/sdks/mistraljobs/README.md)

* [list](docs/sdks/mistraljobs/README.md#list) - Get Batch Jobs
* [create](docs/sdks/mistraljobs/README.md#create) - Create Batch Job
* [get](docs/sdks/mistraljobs/README.md#get) - Get Batch Job
* [cancel](docs/sdks/mistraljobs/README.md#cancel) - Cancel Batch Job

### [chat](docs/sdks/chat/README.md)

* [complete](docs/sdks/chat/README.md#complete) - Chat Completion
* [stream](docs/sdks/chat/README.md#stream) - Stream chat completion

### [classifiers](docs/sdks/classifiers/README.md)

* [moderate](docs/sdks/classifiers/README.md#moderate) - Moderations
* [moderate_chat](docs/sdks/classifiers/README.md#moderate_chat) - Moderations Chat

### [embeddings](docs/sdks/embeddings/README.md)

* [create](docs/sdks/embeddings/README.md#create) - Embeddings
Expand All @@ -337,6 +400,7 @@ The documentation for the GCP SDK is available [here](packages/mistralai_gcp/REA
* [list](docs/sdks/files/README.md#list) - List Files
* [retrieve](docs/sdks/files/README.md#retrieve) - Retrieve File
* [delete](docs/sdks/files/README.md#delete) - Delete File
* [download](docs/sdks/files/README.md#download) - Download File

### [fim](docs/sdks/fim/README.md)

Expand Down Expand Up @@ -479,12 +543,23 @@ if res is not None:
<!-- Start Error Handling [errors] -->
## Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception.

By default, an API error will raise a models.SDKError exception, which has the following properties:

| Property | Type | Description |
|-----------------|------------------|-----------------------|
| `.status_code` | *int* | The HTTP status code |
| `.message` | *str* | The error message |
| `.raw_response` | *httpx.Response* | The raw HTTP response |
| `.body` | *str* | The response content |

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 `list_async` method may raise the following exceptions:

| Error Object | Status Code | Content Type |
| -------------------------- | ----------- | ---------------- |
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4xx-5xx | */* |
| Error Type | Status Code | Content Type |
| -------------------------- | -------------------------- | -------------------------- |
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | \*/\* |

### Example

Expand Down Expand Up @@ -520,9 +595,9 @@ except models.SDKError as e:

You can override the default server globally by passing a server name to the `server: str` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:

| Name | Server | Variables |
| ------ | ------------------------ | --------- |
| `prod` | `https://api.mistral.ai` | None |
| Name | Server | Variables |
| ----- | ------ | --------- |
| `eu` | `https://api.mistral.ai` | None |

#### Example

Expand All @@ -531,7 +606,7 @@ from mistralai import Mistral
import os

s = Mistral(
server="prod",
server="eu",
api_key=os.getenv("MISTRAL_API_KEY", ""),
)

Expand Down Expand Up @@ -653,9 +728,9 @@ s = Mistral(async_client=CustomClient(httpx.AsyncClient()))

This SDK supports the following security scheme globally:

| Name | Type | Scheme | Environment Variable |
| --------- | ---- | ----------- | -------------------- |
| `api_key` | http | HTTP Bearer | `MISTRAL_API_KEY` |
| Name | Type | Scheme | Environment Variable |
| -------------------- | -------------------- | -------------------- | -------------------- |
| `api_key` | http | HTTP Bearer | `MISTRAL_API_KEY` |

To authenticate with the API the `api_key` parameter must be set when initializing the SDK client instance. For example:
```python
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,14 @@ Based on:
### Generated
- [python v1.1.0] .
### Releases
- [PyPI v1.1.0] https://pypi.org/project/mistralai/1.1.0 - .
- [PyPI v1.1.0] https://pypi.org/project/mistralai/1.1.0 - .

## 2024-11-07 19:52:56
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.434.3 (2.452.0) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v1.2.0] .
### Releases
- [PyPI v1.2.0] https://pypi.org/project/mistralai/1.2.0 - .
Loading