xtekky / gpt4free

The official gpt4free repository | various collection of powerful language models
https://g4f.ai
GNU General Public License v3.0
61.01k stars 13.3k forks source link

How I can use AutoGPT/crewAI/babyagi/autogen by using gpt4free #1557

Closed opensource-elearning closed 8 months ago

opensource-elearning commented 9 months ago

Is your feature request related to a problem? Please describe.

As I am a non-programmer background it is very helpful to use the AutoGPT kind of tool but it comes with openai integration and a bunch of other nonsense integration which is painful and demotivates.

if anyone has an example usage How to make use of gpt4free in AutoGPT/crewAI/babyagi or a similar tool it would be highly appreciated

also if you guys have some mechanism or a way by which I can directly get all wokring models and try and also choose another model if the 1st model is not responding?

Describe the solution you'd like

I wanted to have the AutoGPT tool installed in Windows or Linux system in which it has access to file system and it can write to files also multiple agents so that I can get most of my work done by AutoGPT

Describe alternatives you've considered As of now, I am searching for what should I use AutoGPT/babyagi/crewAI/autogen

Please provide code example or references in terms of code examples

opensource-elearning commented 9 months ago

@xtekky @hlohaus @Miezhiko @nullstreak @devAdityaa

hlohaus commented 9 months ago

AutoGPT and etc is not a good use case for gpt4free. It's comparatively slow to the openai api and doesn't support so much requests. But you can simply change the api url from openai to the from g4f. Then you can theoretical use it.

opensource-elearning commented 9 months ago

Thanks @hlohaus, for your quick response.

As belong to a non-programming background can you please let me know if I need to replace

from openai import OpenAI

with

from g4f.openai import OpenAI ?

hlohaus commented 9 months ago
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:1337/v1" # add this line
)

and start the server:


python -m g4f.api.run
``
github-actions[bot] commented 8 months ago

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

quantumalchemy commented 8 months ago

actually just tested with crewai using 'gpt-4-turbo (OpenAI ) and worked ok just a little slow but ok use the max_iter=4, max_rpm=5 (max api calls per min)

opensource-elearning commented 8 months ago

@quantumalchemy, that's great, can you please help to provide the changes you did or the repository/fork/diff though which I can access the changes?

pratham-darooka commented 6 months ago

@quantumalchemy how did you test it? Doesn’t CrewAI rely on langchain - needs some OPENAI_API_KEY? Could you help?

jackiezhangcn commented 6 months ago

for autoGPT, you should modify the api_manager.py file to resort the Models which is defined by OpenAI package. I tried this, but it works slowly