summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md8
-rw-r--r--docs/client.md72
-rw-r--r--g4f/Provider/Bing.py6
3 files changed, 56 insertions, 30 deletions
diff --git a/README.md b/README.md
index f7e9f0f7..be4a2a85 100644
--- a/README.md
+++ b/README.md
@@ -242,6 +242,7 @@ response = client.images.generate(
image_url = response.data[0].url
```
Result:
+
[![Image with cat](/docs/cat.jpeg)](/docs/client.md)
[to the client API](/docs/client.md)
@@ -751,6 +752,13 @@ for choice in json_response:
<td><a href="https://github.com/Lin-jun-xiang/docGPT-streamlit/issues"><img alt="Issues" src="https://img.shields.io/github/issues/Lin-jun-xiang/docGPT-streamlit?style=flat-square&labelColor=343b41"/></a></td>
<td><a href="https://github.com/Lin-jun-xiang/docGPT-streamlit/pulls"><img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/Lin-jun-xiang/docGPT-streamlit?style=flat-square&labelColor=343b41"/></a></td>
</tr>
+ <tr>
+ <td><a href="https://github.com/Simatwa/python-tgpt"><b>python-tgpt</b></a></td>
+ <td><a href="https://github.com/Simatwa/python-tgpt/stargazers"><img alt="Stars" src="https://img.shields.io/github/stars/Simatwa/python-tgpt?style=flat-square&labelColor=343b41"/></a></td>
+ <td><a href="https://github.com/Simatwa/python-tgpt/network/members"><img alt="Forks" src="https://img.shields.io/github/forks/Simatwa/python-tgpt?style=flat-square&labelColor=343b41"/></a></td>
+ <td><a href="https://github.com/Simatwa/python-tgpt/issues"><img alt="Issues" src="https://img.shields.io/github/issues/Simatwa/python-tgpt?style=flat-square&labelColor=343b41"/></a></td>
+ <td><a href="https://github.com/Simatwa/python-tgpt/pulls"><img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/Simatwa/python-tgpt?style=flat-square&labelColor=343b41"/></a></td>
+ </tr>
</tbody>
</table>
diff --git a/docs/client.md b/docs/client.md
index deb5b0ba..74a5efec 100644
--- a/docs/client.md
+++ b/docs/client.md
@@ -1,39 +1,47 @@
-### Client API
-##### from g4f (beta)
+### G4F Client API Documentation (Beta Version)
-#### Start
-This new client could:
+#### Introduction
+The G4F Client API introduces a new way to integrate advanced AI functionalities into your Python applications. This guide will help you transition from using the OpenAI client to the new G4F Client, offering compatibility with the existing OpenAI API alongside additional features.
+
+#### Getting Started
+
+**Switching to G4F Client:**
+
+Replace the OpenAI client import statement in your Python code as follows:
+
+Old Import:
```python
-from g4f.client import Client
+from openai import OpenAI
```
-replaces this:
+New Import:
```python
-from openai import OpenAI
+from g4f.client import Client as OpenAI
```
-in your Python Code.
-New client have the same API as OpenAI.
+The G4F Client maintains the same API interface as OpenAI, ensuring a seamless transition.
-#### Client
+#### Initializing the Client
-Create the client with custom providers:
+To use the G4F Client, create an instance with customized providers:
```python
from g4f.client import Client
from g4f.Provider import BingCreateImages, OpenaiChat, Gemini
client = Client(
- provider=OpenaiChat,
+ text_provider=OpenaiChat,
image_provider=Gemini,
proxies=None
)
```
-#### Examples
+#### Usage Examples
-Use the ChatCompletions:
+**Text Completions:**
+
+You can use the `ChatCompletions` endpoint to generate text completions as follows:
```python
stream = client.chat.completions.create(
@@ -42,36 +50,44 @@ stream = client.chat.completions.create(
stream=True,
)
for chunk in stream:
- if chunk.choices[0].delta.content is not None:
+ if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
```
-Or use it for creating a image:
+**Image Generation:**
+
+Generate images using a specified prompt:
+
```python
response = client.images.generate(
- model="dall-e-3",
- prompt="a white siamese cat",
- ...
+ model="dall-e-3",
+ prompt="a white siamese cat",
+ ...
)
image_url = response.data[0].url
```
-Also this works with the client:
+**Creating Image Variations:**
+
+Create variations of an existing image:
+
```python
response = client.images.create_variation(
- image=open('cat.jpg')
- model="bing",
- ...
+ image=open("cat.jpg", "rb"),
+ model="bing",
+ ...
)
image_url = response.data[0].url
```
-Orginal:
-[![Image with cat](/docs/cat.jpeg)](/docs/client.md)
+#### Visual Examples
+
+Original / Variant:
-Variant:
-[![Image with cat](/docs/cat.webp)](/docs/client.md)
+[![Original Image](/docs/cat.jpeg)](/docs/client.md)
+[![Variant Image](/docs/cat.webp)](/docs/client.md)
-[to Home](/docs/client.md)
+[Return to Documentation Home](/)
+``` \ No newline at end of file
diff --git a/g4f/Provider/Bing.py b/g4f/Provider/Bing.py
index b3852e4e..5b5f89aa 100644
--- a/g4f/Provider/Bing.py
+++ b/g4f/Provider/Bing.py
@@ -141,7 +141,9 @@ class Defaults:
'nlu_direct_response_filter', 'deepleo', 'disable_emoji_spoken_text',
'responsible_ai_policy_235', 'enablemm', 'iyxapbing', 'iycapbing',
'gencontentv3', 'fluxsrtrunc', 'fluxtrunc', 'fluxv1', 'rai278',
- 'replaceurl', 'eredirecturl', 'nojbfedge'
+ 'replaceurl', 'eredirecturl', 'nojbfedge', "fluxcopilot", "nojbf",
+ "dgencontentv3", "nointernalsugg", "disable_telemetry", "machine_affinity",
+ "streamf", "codeint", "langdtwb", "fdwtlst", "fluxprod", "deuct3"
]
# Default cookies
@@ -156,7 +158,7 @@ class Defaults:
class ConversationStyleOptionSets():
CREATIVE = ["h3imaginative", "clgalileo", "gencontentv3"]
- BALANCED = ["galileo"]
+ BALANCED = ["galileo", "gldcl1p"]
PRECISE = ["h3precise", "clgalileo"]
def format_message(msg: dict) -> str: