mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-29 11:23:49 +08:00
chore: 🐝 Update SDK - Generate (spec change merged) 0.11.17 (#422)
Co-authored-by: speakeasybot <bot@speakeasyapi.dev> Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
speakeasybot
speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com>
parent
e62415b7ce
commit
4a9b45c2a0
@@ -89,7 +89,7 @@ This is an open enum. Unrecognized values will not fail type checks.
|
||||
- `"recraft"`
|
||||
- `"reka"`
|
||||
- `"relace"`
|
||||
- `"sakana-ai"`
|
||||
- `"sakana"`
|
||||
- `"sambanova"`
|
||||
- `"seed"`
|
||||
- `"siliconflow"`
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
title: "Category"
|
||||
---
|
||||
|
||||
The category of feedback being reported
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import Category
|
||||
|
||||
# Open enum: unrecognized values are captured as UnrecognizedStr
|
||||
value: Category = "latency"
|
||||
```
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
This is an open enum. Unrecognized values will not fail type checks.
|
||||
|
||||
- `"latency"`
|
||||
- `"incoherence"`
|
||||
- `"incorrect_response"`
|
||||
- `"formatting"`
|
||||
- `"billing"`
|
||||
- `"api_error"`
|
||||
- `"other"`
|
||||
@@ -106,7 +106,7 @@ Provider-specific options keyed by provider slug. Only options for the matched p
|
||||
| `reka` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `relace` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `replicate` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `sakana_ai` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `sakana` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `sambanova` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `sambanova_cloaked` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `seed` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
|
||||
@@ -106,7 +106,7 @@ Provider-specific options keyed by provider slug. Only options for the matched p
|
||||
| `reka` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `relace` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `replicate` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `sakana_ai` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `sakana` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `sambanova` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `sambanova_cloaked` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `seed` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
title: "SubmitGenerationFeedbackRequest"
|
||||
---
|
||||
|
||||
Structured feedback about a specific generation
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- |
|
||||
| `category` | [components.Category](../components/category.mdx) | :heavy_check_mark: | The category of feedback being reported | incorrect_response |
|
||||
| `comment` | *Optional[str]* | :heavy_minus_sign: | An optional free-text comment describing the feedback | The model repeated the same paragraph three times. |
|
||||
| `generation_id` | *str* | :heavy_check_mark: | The generation to submit feedback on | gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG |
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: "SubmitGenerationFeedbackResponse"
|
||||
---
|
||||
|
||||
Confirmation that the feedback was recorded
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
||||
| `data` | [components.SubmitGenerationFeedbackResponseData](../components/submitgenerationfeedbackresponsedata.mdx) | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
title: "SubmitGenerationFeedbackResponseData"
|
||||
---
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- |
|
||||
| `success` | *Literal[True]* | :heavy_check_mark: | Whether the feedback was recorded | true |
|
||||
@@ -106,7 +106,7 @@ Provider-specific options keyed by provider slug. Only options for the matched p
|
||||
| `reka` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `relace` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `replicate` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `sakana_ai` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `sakana` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `sambanova` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `sambanova_cloaked` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `seed` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
|
||||
@@ -89,7 +89,7 @@ This is an open enum. Unrecognized values will not fail type checks.
|
||||
- `"recraft"`
|
||||
- `"reka"`
|
||||
- `"relace"`
|
||||
- `"sakana-ai"`
|
||||
- `"sakana"`
|
||||
- `"sambanova"`
|
||||
- `"seed"`
|
||||
- `"siliconflow"`
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: "SubmitGenerationFeedbackGlobals"
|
||||
---
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.<br/>This is used to track API usage per application.<br/> |
|
||||
| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.<br/> |
|
||||
| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.<br/> |
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: "SubmitGenerationFeedbackRequest"
|
||||
---
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.<br/>This is used to track API usage per application.<br/> | |
|
||||
| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.<br/> | |
|
||||
| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.<br/> | |
|
||||
| `submit_generation_feedback_request` | [components.SubmitGenerationFeedbackRequest](../components/submitgenerationfeedbackrequest.mdx) | :heavy_check_mark: | N/A | \{<br/>"category": "incorrect_response",<br/>"comment": "The model repeated the same paragraph three times.",<br/>"generation_id": "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG"<br/>} |
|
||||
@@ -11,6 +11,7 @@ Generation history endpoints
|
||||
|
||||
* [get_generation](#get_generation) - Get request & usage metadata for a generation
|
||||
* [list_generation_content](#list_generation_content) - Get stored prompt and completion content for a generation
|
||||
* [submit_feedback](#submit_feedback) - Submit feedback for a generation
|
||||
|
||||
## get_generation
|
||||
|
||||
@@ -116,4 +117,56 @@ with OpenRouter(
|
||||
| errors.BadGatewayResponseError | 502 | application/json |
|
||||
| errors.EdgeNetworkTimeoutResponseError | 524 | application/json |
|
||||
| errors.ProviderOverloadedResponseError | 529 | application/json |
|
||||
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
|
||||
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
|
||||
|
||||
## submit_feedback
|
||||
|
||||
Submit structured feedback on a generation the authenticated user made. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
||||
|
||||
### Example Usage
|
||||
|
||||
```python
|
||||
from openrouter import OpenRouter
|
||||
import os
|
||||
|
||||
|
||||
with OpenRouter(
|
||||
http_referer="<value>",
|
||||
x_open_router_title="<value>",
|
||||
x_open_router_categories="<value>",
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.generations.submit_feedback(category="incorrect_response", generation_id="gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG", comment="The model repeated the same paragraph three times.")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
| Parameter | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `category` | [components.Category](../../components/category.mdx) | :heavy_check_mark: | The category of feedback being reported | incorrect_response |
|
||||
| `generation_id` | *str* | :heavy_check_mark: | The generation to submit feedback on | gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG |
|
||||
| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.<br/>This is used to track API usage per application.<br/> | |
|
||||
| `x_open_router_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.<br/> | |
|
||||
| `x_open_router_categories` | *Optional[str]* | :heavy_minus_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.<br/> | |
|
||||
| `comment` | *Optional[str]* | :heavy_minus_sign: | An optional free-text comment describing the feedback | The model repeated the same paragraph three times. |
|
||||
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.mdx) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
|
||||
|
||||
### Response
|
||||
|
||||
**[components.SubmitGenerationFeedbackResponse](../../components/submitgenerationfeedbackresponse.mdx)**
|
||||
|
||||
### Errors
|
||||
|
||||
| Error Type | Status Code | Content Type |
|
||||
| ----------------------------------- | ----------------------------------- | ----------------------------------- |
|
||||
| errors.BadRequestResponseError | 400 | application/json |
|
||||
| errors.UnauthorizedResponseError | 401 | application/json |
|
||||
| errors.NotFoundResponseError | 404 | application/json |
|
||||
| errors.TooManyRequestsResponseError | 429 | application/json |
|
||||
| errors.InternalServerResponseError | 500 | application/json |
|
||||
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
|
||||
Reference in New Issue
Block a user