summaryrefslogtreecommitdiffstats
path: root/g4f/Provider (unfollow)
Commit message (Collapse)AuthorFilesLines
2023-10-22Major Update for Bing - Supports latest bundle version and image analysisLuneye1-42/+222
Here it is, a much-needed update to this service which offers numerous functionalities that the old code was unable to deliver to us. As you may know, ChatGPT Plus subscribers now have the opportunity to request image analysis directly from GPT within the chat bar. Bing has also integrated this feature into its chatbot. With this new code, you can now provide an image using a data URI, with all the following supported extensions: jpg, jpeg, png, and gif! **What is a data URI and how can I provide an image to Bing?** Just to clarify, a data URI is a method for encoding data directly into a URI (Uniform Resource Identifier). It is typically used for embedding small data objects like images, text, or other resources within web pages or documents. Data URIs are widely used in web applications. To provide an image from your desktop and retrieve it as a data URI, you can use this code: [GitHub link](https://gist.github.com/jsocol/1089733). Now, here is a code snippet you can use to provide images to Bing: ```python import g4f provider = g4f.Provider.Bing user_message = [{"role": "user", "content": "Hi, describe this image."}] response = g4f.ChatCompletion.create( model = g4f.models.gpt_4, provider = g4f.provider, # Corrected the provider value messages = user_message, stream = True, image = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4RiSRXhpZgAASUkqAAg..." # Insert your full data URI image here ) for message in response: print(message, flush=True, end='') ``` If you don't want to analyze the image, just do not specify the image parameter. Regarding the implementation, the image is preprocessed within the Bing.py code, which can be resource-intensive for a server-side implementation. When using the Bing chatbot in your web browser, the image is preprocessed on your computer before being sent to the server. This preprocessing includes tasks like image rotation and compression. Although this implementation works, it would be more efficient to delegate image preprocessing to the client as it happens in reality. I will try to provide a JavaScript code for that at a later time. As you saw, I did mention in the title that it is in Beta. The way the code is written, Bing can sometimes mess up its answers. Indeed, Bing does not really stream its responses as the other providers do. Bing sends its answers like this on each iteration: "Hi," "Hi, this," "Hi, this is," "Hi, this is Bing." Instead of sending each segment one at a time, it already adds them on each iteration. So, to simulate a normal streaming response, other contributors made the code wait for the next iteration to retrieve the newer segments and yield them. However, this method ignores something that Bing does. Bing processes its responses in a markdown detector, which searches for links while the AI answers. If it finds a link, it saves it and waits until the AI finishes its answer to put all the found links at the very end of the answer. So if the AI is writing a link, but then on the next iteration, it finishes writing this link, it will then be deleted from the answer and appear later at the very end. Example: "Here is your link reference [" "Here is your link reference [^" "Here is your link reference [^1" "Here is your link reference [^1^" And then the response would get stuck there because the markdown detector would have deleted this link reference in the next response and waited until the AI is finished to put it at the very end. For this reason, I am working on an update to anticipate the markdown detector. So please, if you guys notice any bugs with this new implementation, I would greatly appreciate it if you could report them on the issue tab of this repo. Thanks in advance, and I hope that all these explanations were clear to you!
2023-10-21~ | g4f `v-0.1.7.2`abc16-123/+175
patch / unpatch providers
2023-10-20~abc1-0/+3
minor changes
2023-10-19~abc1-60/+72
automatic models fetching in GUI.
2023-10-19Fix: debug.logging not work in retry providerhs_junxiang1-6/+5
2023-10-17Add timeoutostix3601-1/+6
2023-10-16~ | add `g4f.Provider.GeekGpt`abc2-1/+85
2023-10-16~ | remove non-working providersabc11-32/+107
2023-10-15Add Llama2 and NoowAi ProviderHeiner Lohaus6-7/+153
2023-10-14~abc2-13/+11
fix chatbase (bad) and remove from auto selection
2023-10-14Fix Opchatgpts and ChatForAi ProviderHeiner Lohaus10-101/+116
Deprecate Vitalentum and Aivvm Provider
2023-10-12Deprecate ChatForAiHeiner Lohaus3-5/+6
2023-10-12Add ChatgptLogin, ChatgptFree and GptChatly ProviderHeiner Lohaus10-80/+391
2023-10-12Fix: GptGo json.decoder.JSONDecodeErrorhs_junxiang1-0/+2
2023-10-11~ | g4f v-0.1.6.1abc2-2/+2
some bug fixes
2023-10-10~ | remove DeepAiabc2-83/+0
2023-10-10~ | g4f `v-0.1.5.8`0.1.5.8abc1-1/+1
2023-10-10make user agent easily changeable in deepaiCommenter1233211-2/+3
2023-10-10fix deepai :)Commenter1233211-18/+17
2023-10-10remove unused import in Bing.pyCommenter1233211-1/+0
2023-10-10Aivvm is the best provider no capCommenter1233211-3/+6
2023-10-10Some small fixesHeiner Lohaus9-35/+32
2023-10-10Update Aivvm.pyCommenter1233211-3/+3
2023-10-10~abc1-0/+62
Conversion from str Provider to g4f.Provider
2023-10-09add cool testing for gpt-3.5 and and gpt-4Commenter1233212-20/+27
2023-10-09 Add Proxy Support and Create Provider to ReadmeHeiner Lohaus7-41/+57
Add proxy support to many providers
2023-10-09Add proxy support to all providersHeiner Lohaus28-102/+144
2023-10-08Add Messages and AsyncResult typingHeiner Lohaus5-31/+42
Add system_message in Yqcloud
2023-10-08Add Cromicle to provider listHeiner Lohaus5-27/+62
2023-10-07~ | `v-0.1.5.5`abc3-5/+10
Aiivm working again
2023-10-07Remove Aivvm from working providersHeiner Lohaus3-7/+5
2023-10-07Improve code with aiHeiner Lohaus1-9/+16
2023-10-07Improve code by AIHeiner Lohaus2-25/+27
2023-10-07Add GptGod ProviderHeiner Lohaus13-28/+73
Remove timeout from aiohttp providers Disable Opchatgpts and ChatgptLogin provider
2023-10-07Add GPTalk and GptForLove ProviderHeiner Lohaus5-0/+6618
2023-10-06Fix timeout in create_asyncHeiner Lohaus9-30/+17
2023-10-06~abc1-2/+4
2023-10-06Fix: TypeError: 'type' object is not subscriptablehs_junxiang2-0/+8
2023-10-05Add AiAsk, Chatgpt4Online, ChatgptDemoHeiner Lohaus30-163/+578
and ChatgptX Provider Fix Bing, Liaobots and ChatgptAi Provider Add "gpt_35_long" model and custom timeout
2023-10-04Update Cromicle.pyHexye1-2/+2
2023-10-04Create Cromicle.pyHexye1-0/+50
2023-10-04~ | g4f v-0.1.4.8 - Fixed `g4f.Provider.Bing`abc1-8/+34
implemented new "X-Sydney-EncryptedConversationSignature" found in headers from "turing/conversation/create"
2023-10-04Sort providers in new dirsHeiner Lohaus26-61/+70
2023-10-04Use custom user dirHeiner Lohaus2-26/+16
2023-10-03Fix fetch_access_token in openaiHeiner Lohaus1-10/+16
2023-10-03Add streaming in openai chatHeiner Lohaus2-24/+75
Fetch access token with chromedriver
2023-10-02Bing Updates:Heiner Lohaus1-33/+45
Add retry create conversation Removed get_cookies fallback Add creative tone parameter
2023-10-02Add Phind ProviderHeiner Lohaus3-9/+91
Add release_curl in url_cffi requets Support create image response in Bing
2023-10-02feat: add custom header to deepaiGiancarlo-Ma1-0/+1
2023-10-02Fix: There is no current event loop in threadHeiner Lohaus4-15/+34
2023-10-02Remove fake_useragent moduleHeiner Lohaus1-4/+0
2023-10-02+Curl +Async +Stream RequestsHeiner Lohaus7-32/+33
Update Model List
2023-10-02fix typo in payloadst4rted1-2/+2
2023-10-01Change event loop policy on windowsHeiner Lohaus1-2/+9
Support more versions from curl_cffi
2023-10-01aivvm's no life creator keeps patching it, but I'm just better 😉Commenter1233211-3/+4
2023-10-01Disable Wewordle ProviderHeiner Lohaus2-9/+3
Update Ylokh Provider Improve StreamRequest
2023-10-01Disable PerplexityAi ProviderHeiner Lohaus2-2/+2
2023-10-01Update HuggingChat to new apiHeiner Lohaus8-91/+183
Impersonate Aivvm Provider Add ChatForAi and FreeGpt Provider Update AItianhuSpace Provider Improve StreamRequest Support Update get_event_loop Helper
2023-09-29Fix Aivvm and add new models in models.pyCommenter1233211-16/+15
2023-09-26Add ChatgptDuo and Aibn ProviderHeiner Lohaus7-75/+191
Add support for "nest_asyncio", Reuse event_loops with event_loop_policy Support for "create_async" with synchron provider
2023-09-26AItianhuSpace Provider with GPT 4 addedHeiner Lohaus2-15/+46
Reduced chunksize to better text completion
2023-09-26"create_async" support for BaseProvider,Heiner Lohaus3-2/+78
by using ThreadPoolExecutor Default Model for Vercel
2023-09-25Add Myshell ProviderHeiner Lohaus5-17/+181
Remove auto proxy prefix
2023-09-23Fix: Aivvm: KeyError: ''Heiner Lohaus1-3/+9
and TypeError: issubclass() arg 1 must be a class
2023-09-23 ~ | improve Vercel & g4f.Completion.createabc1-1/+1
2023-09-23~ | improve Vercel & g4f.Completion.createabc1-2/+6
added `.Completion.create` class. ```py response = g4f.Completion.create( model='text-davinci-003', prompt="Hello") print(response) ```
2023-09-23~abc1-0/+369
2023-09-23Delete g4f/Provider/Vercel.pyTekky1-387/+0
2023-09-23Improve Vercel Provider:Heiner Lohaus3-45/+62
- Fix endless loop - Add proxy, async support - Add default model Fix HuggingChat Provider
2023-09-23~ | Update Vercel Providerabc1-227/+307
2023-09-23~ | new providersabc2-59/+50
Somwhat fix Aivvm provider, which looks to have a working gpt-4 kinda unstable
2023-09-23~ | Fix DeepAiabc1-1/+1
2023-09-21Add RetryProviderHeiner Lohaus2-1/+86
2023-09-20Fix create_event_loop functionHeiner Lohaus3-10/+100
Add PerplexityAi Provider
2023-09-20Improve code style in async supportHeiner Lohaus1-10/+22
2023-09-20Add "create_event_loop" helperHeiner Lohaus1-9/+13
2023-09-20Add check_running_loop requirementHeiner Lohaus1-5/+18
Add create_async function in ChatCompletion Use SelectorEventLoop on windows
2023-09-20Cache "snlm0e" in BardHeiner Lohaus7-25/+42
Improve error handling in ChatgptLogin Fix async example in readme
2023-09-19~abc1-64/+2
2023-09-18Improve event loopHeiner Lohaus2-42/+44
2023-09-18Add GptGo Provider, Fix AItianhu ProviderHeiner Lohaus3-41/+98
2023-09-17~Tekky1-353/+0
2023-09-17Revert "Fix type hint"Tekky25-25/+25
2023-09-16fix typo: provider -> ProviderMIDORIBIN25-25/+25
2023-09-12Disable not working providers:Heiner Lohaus5-14/+9
EasyChat, Equing, GetGpt, Liaobots and Wuguokai No and random best provider for a model Update providers in Readme
2023-09-12Add new providers: Aivvm, Vitalentum and YlokhHeiner Lohaus7-25/+251
2023-09-10Add ChatBase ProviderHeiner Lohaus2-0/+64
2023-09-09Add CodeLinkAva Provider, Improve test_async.pyHeiner Lohaus4-2/+67
2023-09-05Fix imports in BingHeiner Lohaus1-16/+7
2023-09-05Add to many provider async and stream support, Fix Ails, AItianhu, ChatgptAi, ChatgptLogin Provider, Add fallback cookies to Bing, Improve OpenaiChat ProviderHeiner Lohaus17-528/+443
2023-09-04Join the messageshs_junxiang7-29/+14
A better approach is to use the `.join()` method of strings, which reduces string concatenation operations and improves performance. Additionally, using formatted strings (f-strings) makes the code cleaner and more readable.
2023-09-03type hintsmsi-JunXiang33-45/+174
Use `from __future__ import annotations avoid `dict` and `list` cause "TypeErro: 'type' object is not subscriptable". Refer to the following Stack Overflow discussions for more information: 1. https://stackoverflow.com/questions/75202610/typeerror-type-object-is-not-subscriptable-python 2. https://stackoverflow.com/questions/59101121/type-hint-for-a-dict-gives-typeerror-type-object-is-not-subscriptable
2023-09-01Set working=True in Liaobots, Fix bing provider, Update readmeHeiner Lohaus4-24/+6
2023-08-28~ | v-0.0.2.6abc1-25/+25
2023-08-28Update Bing.pyLuneye1-7/+7
Fixed some errors in my previously precipitated commit.
2023-08-28Update Bing.pyLuneye1-53/+45
Added support the async function Will implement proper cookie retrieval later but Bing is working for now
2023-08-28Add async support for H2oHeiner Lohaus12-311/+461
Add format_prompt helper Fix create_completion in AsyncGeneratorProvider Move get_cookies from constructor to function Add ow HuggingChat implement Remove need auth form Liabots Add staic cache for access_token in OpenaiChat Add OpenAssistant provider Support stream and async in You Support async and add userId in Yqcloud Add log_time module
2023-08-27Update Bing.py Luneye1-46/+76
Removed unnecessary check that could prematurely stop the AI's response while answering
2023-08-27~ | code stylingabc30-790/+695
2023-08-25Add OpenaiChat and Hugchat ProviderHeiner Lohaus6-79/+259
Add tests for providers with auth Improve async support / 2x faster Shared get_cookies by domain function
2023-08-25Ails Supplementary Identification of Unusual Response Contentzengrr1-1/+1
2023-08-24Improve provider listHeiner Lohaus5-11/+11
2023-08-24remove whitspace from data: and raise exceptionBagus Indrayana1-3/+5
2023-08-23Ails throw the contents of an error responsezengrr1-0/+2
2023-08-23fix Yqcloud's prompter using only the last messagezengrr1-1/+4
2023-08-23"You" unicode decode and fix prompt just is last messagezengrr1-5/+8
2023-08-23Add create_async methodHeiner Lohaus1-19/+39
2023-08-22Improve providers with testsHeiner Lohaus6-20/+18
2023-08-22fix Equing response error with no streamzengrr1-0/+3
2023-08-22set encoding and temperaturezengrr3-5/+10
2023-08-21Fix bing providerHeiner Lohaus1-261/+203
2023-08-20change linkBagus Indrayana1-8/+9
2023-08-20fix theb but need authBagus Indrayana1-15/+72
2023-08-20update header & response easychatBagus Indrayana1-9/+30
2023-08-18Fix bard provider, add async supportHeiner Lohaus1-69/+67
2023-08-17Update Yqcloud.pyMaxKUlish11-0/+1
# specify the correct encoding forcibly
2023-08-17Update Yqcloud.pyMaxKUlish11-1/+0
2023-08-17Update Yqcloud.pyMaxKUlish11-0/+1
# specify the correct encoding forcibly
2023-08-17add providerBagus Indrayana2-1/+68
2023-08-17refactor V50 and RaycastBagus Indrayana2-85/+123
2023-08-17 ~ | major refractoring + new providers | v0.0.2.0abc4-1/+162
g4f.Provider.FastGpt & g4f.Provider.Equing gpt-3.5-turbo-0613
2023-08-17add proxy and remove streamBagus Indrayana1-1/+1
2023-08-17add v50Bagus Indrayana2-0/+44
2023-08-17~ | major refractoring | v0.0.2.0abc2-4/+4
2023-08-14refactor: refactor providerMIDORIBIN55-2095/+2317
2023-08-14small fixes & new pypi versionabc1-0/+110
2023-08-14Fix Ails.pyjohnd0e1-1/+1
Fix arguments order
2023-08-12Update EasyChat.pyomidima1-10/+9
Resolve review comments.
2023-08-11Update EasyChat.pyomidima1-1/+8
update active servers
2023-08-09Add Raycast Providerye42412-0/+51
2023-08-08Update EasyChat.pyomidima1-16/+17
Change model address and add proxy & session for pass cloudflare auth on requests.
2023-08-05Update Ails.pyVastV21-3/+5
after they update the client-v version the page is not working anymore, so I made this to get the version number automatically, this way we don't need to update the version manually.
2023-08-05Update DeepAi.pyomidima1-26/+52
2023-08-01Update __init__.pykggn1-1/+1
2023-08-01Update __init__.pykggn1-0/+1
2023-08-01Create opchatgpts.pykggn1-0/+42
2023-07-24Update Vercel.pyabc1-109/+8
2023-07-22Use the temperature parametergrandsonneo@gmail.com6-13/+13
2023-07-21Fix the import errorsnonk1231-0/+0
2023-07-19Update Provider.DfeHub to consider rate-limitnajam-tariq1-1/+9
2023-07-18Rename DFEHub.py to DfeHub.pyxtekky1-1/+1
2023-07-18.abc1-1/+1
2023-07-16minor fixesabc25-63/+101
2023-07-16minor fixesabc4-5/+4
ails, chatgptai ...
2023-07-12refactor/move provider from testing folderBagus Indrayana5-0/+364
2023-07-10Add files via uploadAlephZero2551-105/+93
Fix empty H2o output
2023-07-05some more providersnajam-tariq5-1/+169
2023-06-29fix subDomain of LockChatLê Anh Tuấn1-2/+2
2023-06-27Fix: There is no current event loop in thread.Ramon Victor Cardoso1-12/+13
2023-06-24gpt4free v2, first releasev2t.me/xtekky20-0/+1442