Code Files for Streaming responses with GPT Function Calling. Structured data with GPT 4 and Gpt 3.5 turbo video
🕑 Added 2023-07-04 10:18:43 +0000 UTCThis is for video: https://youtu.be/iYT9aKZml3Y
In this video we will focus on how we can get streaming responses using OpenAI function calling. We will also look at how we can use functons calling only to extract structured data out of gpt 3.5 turbo and gpt4. We extract summary, important points and key word out of a document
Search 140+ echohive videos and code download links: https://www.echohive.live/
Try the GPT-4 Auto Coder app: https://gpt4autocoder.streamlit.app/
Chat with us on Discord: https://discord.gg/PPxTP3Cs3G
GPT-4 web UI: https://gpt-4.up.railway.app/
Comments
Echo Hive
I responded under your original comment. You can use try, except for json.load and when that fails you can just get the regular response and give that back as feedback. That should be fine. Or you can try to parse it with string method or with regex
xiaoyang feng
There's always something wrong with that one:~program_criticism_feedback = json.loads(clean_responses)["criticism_feedback"]~
Echo Hive
I give an example of how to do that in gpt-4 scientist
Echo Hive
Yeah, that happens when gpt returns a response which the json can not parse. This happens especially with 3.5. You can try to parse the result using reflex or other regular methods for when this happens.
xiaoyang feng
Traceback (most recent call last): File "/mnt/sda/github/echohive/0802Function_calling/multi_call_maker.py", line 77, in start_maker_process() File "/mnt/sda/github/echohive/0802Function_calling/multi_call_maker.py", line 74, in start_maker_process run_maker_process(user_input, model) File "/mnt/sda/github/echohive/0802Function_calling/multi_call_maker.py", line 10, in run_maker_process criticism_feedback = program_criticism_feedback(user_input,general_outline, model) File "/mnt/sda/github/echohive/0802Function_calling/separate_calls.py", line 132, in program_criticism_feedback program_criticism_feedback = json.loads(clean_responses)["criticism_feedback"] File "/opt/miniconda3/envs/py310_chat/lib/python3.10/json/__init__.py", line 346, in loads return _default_decoder.decode(s) File "/opt/miniconda3/envs/py310_chat/lib/python3.10/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/opt/miniconda3/envs/py310_chat/lib/python3.10/json/decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 125 (char 124)