Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xihajun/fakeopenai
https://github.com/xihajun/fakeopenai
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/xihajun/fakeopenai
- Owner: xihajun
- Created: 2023-08-10T21:22:37.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-24T00:11:20.000Z (over 1 year ago)
- Last Synced: 2023-09-24T05:46:34.750Z (over 1 year ago)
- Language: Python
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FakeOpenAI Python Wrapper
A Python wrapper for the FakeOpenAI API, mimicking the functionality provided by the official OpenAI Python package.
## Features
- Send chat completions to the FakeOpenAI API.
- Easy to integrate with existing projects that use the OpenAI Python package.## Installation
You can install the `fakeopenai` package using pip:
```bash
pip install fakeopenai
```## Usage
Here's a quick guide to get started with the `fakeopenai` package:
1. **Set your API key**:
```python
import fakeopenai
import osFAKEOPENAI_KEY = os.environ.get("FAKEOPENAI_KEY")
fakeopenai.set_api_key(FAKEOPENAI_KEY)
```2. **Generate a response**:
```python
response = fakeopenai.ChatCompletion_create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Tell me a joke."},
]
)assistant_reply = response['choices'][0]['message']['content']
print("Assistant:", assistant_reply)
```## Documentation
For more detailed information about the methods and functions, refer to the code documentation in the `fakeopenai` directory.
## Contributing
We welcome contributions to this package! If you find any bugs or have suggestions for improvements, please open an issue or submit a pull request.
## License
This package is licensed under the MIT License.
---
Feel free to modify or expand upon this README to better fit your needs or to add any other relevant information about the package.
## Note:
https://github.com/pengzhile/pandora/blob/master/doc/HTTP-API.md
https://github.com/pengzhile/pandora/blob/7aff316c9b4bbc75dc15983a75bef75336b8d0d9/src/pandora/openai/api.py#L314
https://github.com/pengzhile/pandora/issues/837