add documents
This commit is contained in:
61
docs/index.md
Normal file
61
docs/index.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# FastGPT Python SDK
|
||||
|
||||
The official Python SDK for interacting with FastGPT's OpenAPI.
|
||||
|
||||
## Overview
|
||||
|
||||
FastGPT Python SDK is a client library that provides a simple, Pythonic interface to FastGPT's powerful AI platform. It supports both synchronous and asynchronous operations, with built-in retry logic, error handling, and connection pooling.
|
||||
|
||||
### Key Features
|
||||
|
||||
- **Easy to Use**: Simple, intuitive API design following Python best practices
|
||||
- **OpenAI-Compatible**: The `/api/v1/chat/completions` endpoint is fully OpenAI-compatible
|
||||
- **Context Manager Support**: Automatic resource cleanup with `with` statements
|
||||
- **Async Support**: Full async/await support for high-performance applications
|
||||
- **Built-in Retry Logic**: Automatic retries with configurable backoff
|
||||
- **Streaming**: Support for streaming responses
|
||||
- **Chat Context**: Maintain conversation history with `chatId`
|
||||
- **Template Variables**: Dynamic content substitution with variables
|
||||
|
||||
## Quick Example
|
||||
|
||||
```python
|
||||
from fastgpt_client import ChatClient
|
||||
|
||||
# Basic chat completion
|
||||
with ChatClient(api_key="fastgpt-xxxxx") as client:
|
||||
response = client.create_chat_completion(
|
||||
messages=[{"role": "user", "content": "Hello!"}],
|
||||
stream=False
|
||||
)
|
||||
result = response.json()
|
||||
print(result['choices'][0]['message']['content'])
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install fastgpt-client
|
||||
```
|
||||
|
||||
## Client Types
|
||||
|
||||
| Client | Description |
|
||||
|--------|-------------|
|
||||
| `ChatClient` | For chat operations and conversation management |
|
||||
| `AppClient` | For app analytics and logs |
|
||||
| `AsyncChatClient` | Async version of ChatClient |
|
||||
| `AsyncAppClient` | Async version of AppClient |
|
||||
|
||||
## Documentation
|
||||
|
||||
- **[Getting Started](getting_started/installation.md)** - Installation and setup
|
||||
- **[API Reference](api/overview.md)** - Complete API documentation
|
||||
- **[Examples](examples/basic_usage.md)** - Usage examples
|
||||
- **[Advanced Topics](advanced/error_handling.md)** - Advanced features
|
||||
|
||||
## Links
|
||||
|
||||
- [FastGPT Documentation](https://doc.fastgpt.io/)
|
||||
- [Chat API Documentation](https://doc.fastgpt.io/docs/introduction/development/openapi/chat)
|
||||
- [GitHub Repository](https://github.com/yourusername/fastgpt-python-sdk)
|
||||
Reference in New Issue
Block a user