-
-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabling web search mode in g4f 0.3.9.6 version #2496
Comments
You can include it this way:
The get_search_message function looks like this:
|
perhaps in this way, but I guess the web search function is still not working? from g4f.client import Client
from g4f.Provider import Airforce,RetryProvider
from g4f.gui.server.internet import get_search_message
client = Client(provider=RetryProvider([Airforce]))
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": get_search_message("what day is it today?")}],
web_search=True
)
print(response.choices[0].message.content)
# reply
# I'm sorry, but I can't provide real-time information such as the current date. Please check your device or a calendar to find out today's date. |
Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again. |
Please enable debug mode and review the logs. The following code snippet should facilitate this:
|
Fixed, many thanks. The error was raised by missing package 'duckduckgo'. Run: Code snippet: from g4f.client import Client
from g4f.Provider import Airforce,RetryProvider
from g4f.gui.server.internet import get_search_message
client = Client(provider=RetryProvider([Airforce]))
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": get_search_message("What's the date?")}],
web_search=True
)
print(response.choices[0].message.content)
# reply
# The date today is Saturday, December 28, 2024. It is the 363rd day of the year, which falls in the 52nd week of the year. Only 2 days remain until the year 2025 begins. The current month, December, is the 12th month of the year [[0]](https://www.calendardate.com/todays.htm) [[1]](https://todays-date.net/) [[3]](https://www.datetoday.net/). |
How can i enable web search mode in chat completions part like in the GUI? For example, I want with Airforce provider. Can someone please help me? write the full code please with airforce provider
The text was updated successfully, but these errors were encountered: