Giter VIP home page Giter VIP logo

Comments (6)

oleteacher avatar oleteacher commented on June 11, 2024 1

Thank you for the reply and information.

I had assumed that one could use with your chatgpt example with gpt-3.5-turbo after seeing this in your readme:

"Example for integration from GPT 3, 3.5 & 4 for your websites in HTML, CSS, JS & PHP"

Tried in your config.php:

<?php
// config file
define('OPENAI_API_KEY', 'sk-.................................');
define('MODEL', gpt-3.5-turbo');
define('TEMPERATURE', 0.9);
define('MAX_TOKENS', 1000);
define('TOP_P', 1);
define('FREQUENCY_PENALTY', 0.0);
define('PRESENCE_PENALTY', 0.0);

So, this was just misunderstanding with what was written in your readme. No biggie just thought it would be worth asking about.

Thanks again.

from gpt-api-integration-in-html-css-with-js-php.

VolkanSah avatar VolkanSah commented on June 11, 2024 1

I update the readme.md with the endpoints.
Set to your needs.
a 'star' will be cool if my work helps you

from gpt-api-integration-in-html-css-with-js-php.

VolkanSah avatar VolkanSah commented on June 11, 2024

Hi Susanne,

I hope you're doing well. I saw your GitHub issue regarding an error you encountered while using a chatbot model in your code. After reviewing your code and the error message, it appears that the model you're using, 'gpt-3.5-turbo', is not supported by the OpenAI API for the V1/c endpoint. This is because the model is a chat model, and not suitable for the V1/c endpoint.

OpenAI offers a variety of models for different use cases, including chatbots. If you're looking to create a chatbot, I recommend selecting a supported chatbot model like Davinci, Curie, Ada, Babbage, or Codex.

It's also important to ensure that the selected model is suitable for the API version you're using. Please make sure you choose the correct API version and model for your application.

-> you must use ' /v1/chat/completions' for ' gpt-3.5-turbo or gpt-3.5-turbo-0301' and not '/v1/engines/' what I use in this example
setup gptchat.php & config.php to your needs

More Infos

ENDPOINT MODEL NAME
/v1/chat/completions gpt-4, gpt-4-0314, gpt-4-32k, gpt-4-32k-0314, gpt-3.5-turbo, gpt-3.5-turbo-0301
/v1/completions text-davinci-003, text-davinci-002, text-curie-001, text-babbage-001, text-ada-001
/v1/edits text-davinci-edit-001, code-davinci-edit-001
/v1/audio/transcriptions whisper-1
/v1/audio/translations whisper-1
/v1/fine-tunes davinci, curie, babbage, ada
/v1/embeddings text-embedding-ada-002, text-search-ada-doc-001
/v1/moderations text-moderation-stable, text-moderation-latest
/v1/engines/ engine v1

I hope this helps you solve the issue you encountered. If you have any further questions or concerns, please don't hesitate to reach out.

Best regards,

Volkan Sah

from gpt-api-integration-in-html-css-with-js-php.

oleteacher avatar oleteacher commented on June 11, 2024

Oh yes, gave you a star!

I am doing something wrong it appears. My old brain is not grasping what you are providing:)

I have changed the following to use chatgpt-3.5-turbo:

define('MODEL', 'gpt-3.5-turbo');

Then:

curl_setopt($ch, CURLOPT_URL, "https://api.openai.com/v1/chat/" . MODEL . "/completions");

Not working, get this dev console error:

script.js:27 Error: Unexpected response format Objecterror: {message: 'Invalid URL (POST /v1/chat/gpt-3.5-turbo/completions)', type: 'invalid_request_error', param: null, code: null}[[Prototype]]: Object
(anonymous) @ script.js:27

from gpt-api-integration-in-html-css-with-js-php.

VolkanSah avatar VolkanSah commented on June 11, 2024

look for /v1/chat/completions than . Model.
use this curl_setopt($ch, CURLOPT_URL, "https://api.openai.com/v1/chat/completions" .... i will check it too, later. Must sleep :(
sorry you must understand what you do there or you can harm yourself. It is a simple function.
Please read https://platform.openai.com/docs/api-reference/introduction on openAi

from gpt-api-integration-in-html-css-with-js-php.

VolkanSah avatar VolkanSah commented on June 11, 2024

It works well please adust to your needs! Here a guidline for how handel with security tipps
https://github.com/VolkanSah/ChatGPT-Security-Best-Practices

from gpt-api-integration-in-html-css-with-js-php.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.