Comments (1)
Hi, decode the response and access the content
<?php
$j = '{"id":"chatcmpl-6xxhQ2FLm08VhE8KKHsTpilkvpMTS","object":"chat.completion","created":1679748856,"model":"gpt-3.5-turbo-0301","usage":{"prompt_tokens":9,"completion_tokens":10,"total_tokens":19},"choices":[{"message":{"role":"assistant","content":"This is a test of the AI language model."},"finish_reason":"length","index":0}]}';
$d = json_decode($j);
echo($d->choices[0]->message->content);
Note that, basic PHP knowledge is required before using this library.
from open-ai.
Related Issues (20)
- 'answers' is not one of ['fine-tune'] - 'purpose' HOT 1
- Where are the error codes from the OpenAI documentation ? HOT 4
- OpenAI now has gpt-turbo-3.5 fine tuning the one you have currently is deprecated can you add the new api calls? HOT 4
- Auto-continuing when max_token limit reached HOT 1
- there is a responsibility for the temperature values HOT 1
- ChatGPT 4 API Support HOT 1
- text-davinci-003 is deprecated HOT 2
- The data returned is confusing when use stream HOT 11
- ChatGPT request very slowly, up to 2-3 mins HOT 3
- Model API route no longer returning permissions HOT 3
- DALLE-3 HOT 1
- New Assistants API support? HOT 10
- Does the new speech-to-text api offer support? HOT 1
- Chat API: first event line gets split into two for streamed response HOT 1
- Sorry, you have been blocked HOT 5
- tts support HOT 2
- json_object HOT 2
- Obsolete README
- Function calling HOT 1
- Function Calling? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from open-ai.