1.8 KiB
BingChat User Guide
Welcome to the BingChat user guide! This document provides a step-by-step tutorial on how to leverage the BingChat class, an interface to the EdgeGPT model by OpenAI.
Table of Contents
- Installation & Prerequisites
- Setting Up BingChat
- Interacting with BingChat
- Generating Images
- Managing Cookies
Installation & Prerequisites
Before initializing the BingChat model, ensure you have the necessary dependencies installed:
pip install EdgeGPT
Additionally, you must have a cookies.json
file which is necessary for authenticating with EdgeGPT.
Setting Up BingChat
To start, import the BingChat class:
from bing_chat import BingChat
Initialize BingChat with the path to your cookies.json
:
chat = BingChat(cookies_path="./path/to/cookies.json")
Interacting with BingChat
You can obtain text responses from the EdgeGPT model by simply calling the instantiated object:
response = chat("Hello, my name is ChatGPT")
print(response)
You can also specify the conversation style:
from bing_chat import ConversationStyle
response = chat("Tell me a joke", style=ConversationStyle.creative)
print(response)
Generating Images
BingChat allows you to generate images based on text prompts:
image_path = chat.create_img("Sunset over mountains", auth_cookie="YOUR_AUTH_COOKIE")
print(f"Image saved at: {image_path}")
Ensure you provide the required auth_cookie
for image generation.
Managing Cookies
You can set a directory path for managing cookies using the set_cookie_dir_path
method:
BingChat.set_cookie_dir_path("./path/to/cookies_directory")