Skip to content

Commit

Permalink
Merge pull request #222 from windsonsea/service
Browse files Browse the repository at this point in the history
[en] update en text in models/service.md
  • Loading branch information
windsonsea authored Jan 23, 2025
2 parents 5089538 + 63d9f23 commit 945c745
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dev:
- "scripts/**/*"
- ".github/**/*"

dmc:
models:
- "docs/zh/docs/models/**/*"
- "docs/zh/docs/en/models/**/*"

Expand Down
77 changes: 44 additions & 33 deletions docs/zh/docs/en/models/service.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,45 @@
# Model Services

Model services are a solution for quickly deploying open-source or fine-tuned large language models as callable services. With one-click deployment, the complex management of models is simplified into a standardized service format, compatible with mainstream model service API call capabilities, meeting the demand for immediate use.
Model services provide a solution for quickly deploying open-source or fine-tuned large language models
as callable services. With one-click deployment, the complex management of models is simplified into a
standardized service format. This format is compatible with mainstream model service API call capabilities,
enabling immediate use.

- Model services allow users to call selected models to perform tasks such as text generation, chat processing, image generation, etc.
- Supports online experience of models.
- Model services allow users to call selected models to perform tasks such as text generation,
chat processing, image generation, and more.
- These services support the online experience of models.

The details of the model service include basic information about the service, authorization methods, and call examples.
The details of the model service include basic information about the service, available
authorization methods, and example API calls.

## Basic Information

- Model Service Name: The name of the current service, used to identify this model service.
- Access Path Name: Each model service has a unique path name.
- Model Type: The model being used by the current service.
- Status: The current status of the service.
- Billing Method: The billing method for the current service.
- **Model Service Name:** The name of the service, used to identify this model service.
- **Access Path Name:** A unique path name for each model service.
- **Model Type:** The type of model used by the service.
- **Status:** The current operational status of the service.
- **Billing Method:** The billing method for the service.

## Authorization Methods

- API-Key Authorization:
### API-Key Authorization

- All API requests need to include an Authorization field in the HTTP Header for identity verification.
- Format: Authorization: Bearer {API_KEY}
- You can obtain the key through the "View My API-Key" link on the page.
- All API requests require the inclusion of an `Authorization` field in the HTTP header for identity verification.
- Format: `Authorization: Bearer {API_KEY}`
- You can obtain your API key by clicking the "View My API-Key" link on the page.

- Security Advice: Store the API-Key on the backend server to avoid exposing the key in client-side code and prevent leakage.
### Security Advice

- Store the API key securely on the backend server to prevent exposure in client-side code
and avoid potential security leaks.

## API Call Example

- Request URL: The POST request URL is `https://sh-02.d.run/v1/chat/completions`
### Request URL

The POST request URL is:

`https://sh-02.d.run/v1/chat/completions`

### Request Example: Calling the API with curl

Expand All @@ -42,16 +54,17 @@ curl 'https://sh-02.d.run/v1/chat/completions' \
}'
```

Parameter Explanation:
**Request Parameters:**

- model: The access path name of the model service (e.g., u-8105f7322477/test).
- messages: A list of chat history containing user input, for example:
- **model:** The access path name of the model service (e.g., `u-8105f7322477/test`).
- **messages:** A list of chat history containing user input, for example:

```json
[{"role": "user", "content": "Say this is a test!"}]
```

- temperature: Controls the randomness of the generated results; a higher value results in more creative outputs, while a lower value yields more stable outputs.
- **temperature:** Controls the randomness of the generated output. A higher value produces
more creative results, while a lower value yields more stable outputs.

### Response Example

Expand Down Expand Up @@ -79,21 +92,19 @@ Parameter Explanation:
}
```

Response Field Explanation:

- id: A unique identifier for the generated result.
- model: The ID of the model service being called.
- choices: An array of results generated by the model.
- message: The generated content.
- content: The text content generated by the model.
- usage: Token usage for this call:
- prompt_tokens: The number of tokens for user input.
- completion_tokens: The number of tokens for the generated result.
- total_tokens: The total usage.
**Response Fields:**

- Integration Development Examples
- **id:** A unique identifier for the generated result.
- **model:** The ID of the model service being called.
- **choices:** An array of results generated by the model.
- **message:** The generated content.
- **content:** The text content produced by the model.
- **usage:** Token usage for this call:
- **prompt_tokens:** The number of tokens used for the user input.
- **completion_tokens:** The number of tokens used for the generated response.
- **total_tokens:** The total token usage.

### Python Example Code
### Python Example

```python
# Compatible with OpenAI Python library v1.0.0 and above
Expand All @@ -120,7 +131,7 @@ content = response.choices[0].message.content
print(content)
```

### Node.js Example Code
### Node.js Example

```js
const OpenAI = require('openai');
Expand Down

0 comments on commit 945c745

Please sign in to comment.