Skip to content
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

G4F #2402

Open
sanjar1221 opened this issue Nov 21, 2024 · 2 comments
Open

G4F #2402

sanjar1221 opened this issue Nov 21, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@sanjar1221
Copy link

const { G4F } = require("g4f");
const g4f = new G4F();

const messages = [
{ role: "user", content: "Hi, what's up?"}
];

const options = {
provider: g4f.providers.GPT,
model: "gpt-3.5-turbo",
debug: true,
proxy: ""
};

(async () => {
try {
console.log("Sending request...");

    // Отправляем запрос и получаем ответ
    const response = await g4f.chatCompletion(messages, options);
    
    // Логируем полученный ответ
    console.log("Raw response:", JSON.stringify(response, null, 2));

    if (!response) {
        console.error("No response returned.");
    } else {
        console.log("Response:", JSON.stringify(response, null, 2));
    }
} catch (error) {
    console.error("Error:", error.message);
    console.error("Full Error:", JSON.stringify(error, null, 2));  // Логируем подробности ошибки
}

})();

Sending request...
[provider] » ... awaiting Picking a provider from the working list...
[provider] » √ success Provider found: GPT

[model] » √ success Using the model: gpt-3.5-turbo

[provider] » ... awaiting Fetching data from the provider: GPT
Error: Invalid response.
Full Error: {}

@sanjar1221 sanjar1221 added the bug Something isn't working label Nov 21, 2024
@sanjar1221
Copy link
Author

pls help

@hlohaus
Copy link
Collaborator

hlohaus commented Nov 23, 2024

The "gpt-3.5-turbo" model may be outdated and might not perform optimally for your needs.
Consider using an alternative model or provider. Here's an example of how you can specify the model and provider in your code:

const options = {
    provider:  "Copilot",  // Microsoft Copilot
    model: "",  // Default model  
    debug: true,                     
    proxy: ""                       
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants