I don't see any examples using HTTP since most of the people connecting just use one of the 8 languages they already support. If you have a way, or are familiar with httpsend in Synapse I'm looking for a helping hand. Thanks.See making requests (https://beta.openai.com/docs/api-reference/making-requests) in the documentation. This shows a simple request example. Comparing the headers in the example with your code shows that the Authorization header field seems to be missing. Also, the query should be packed into a JSON structure, as per example.
AProcess.Parameters.Add('-d ''{"model": "text-davinci-003", "prompt": "Say this is a test", "temperature": 0, "max_tokens": 7}''');
I'm not sure the JSON text should be inside single quotes. Try removing the single quotes before the { and after the }. Alternatively replace the single quotes with double quotes (") around the JSON, similar to the other parameters.
Here's a simpler example that works, do not forget to substitute YOUR_API_KEY with your own:
program testopenai; {$mode objfpc}{$ofdef mswindows}{$apptype console}{$endif} uses Classes, Process; var AStringList : TStrings; Aprocess: TProcess; begin AProcess := TProcess.Create(nil); try AProcess.Options := AProcess.Options + [poWaitOnExit,poUsePipes]; AProcess.Executable:='curl.exe'; AProcess.Parameters.Add('https://api.openai.com/v1/models/text-davinci-003'); AProcess.Parameters.Add('-H'); Aprocess.Parameters.Add('"Authorization: Bearer YOUR_API_KEY"'); // do not quote your_APi_KEY!! AProcess.Execute; try AStringList := TStringList.Create; AStringList.LoadFromStream(AProcess.Output); Writeln(AStringList.Text); finally AStringList.Free; end; Finally AProcess.Free; end; end.
QuoteI'm not sure the JSON text should be inside single quotes. Try removing the single quotes before the { and after the }. Alternatively replace the single quotes with double quotes (") around the JSON, similar to the other parameters.
Good day, thank you very much for your answer. I tried the following two options and still got the same error message as above....
AProcess.Parameters.Add('-d {"model": "text-davinci-003", "prompt": "Say this is a test", "temperature": 0, "max_tokens": 7}');
and
AProcess.Parameters.Add('-d "{"model": "text-davinci-003", "prompt": "Say this is a test", "temperature": 0, "max_tokens": 7}"');
Do you have any idea what the problem could be?
Thank you very much for your time.
I wasn't aware of that OpenAI but it is really interesting.Their work is truly breathtaking!
'{"model": "text-davinci-003", "prompt": "write a program in pascal that calculates the distance between the earth and the moon today","temperature": 0.7,"max_tokens": 256,"top_p": 1, "frequency_penalty": 0, "presence_penalty": 0}';
*snip*Yes, it is. At first.
Pretty impressive!
With an error rate of 1 out of 2, this AI is pretty much useless.Or about as useful as a typical first year university/college student :)
At least it seems to be always valid Pascal.I show you something funny.
Me: Create a Delphi console application that implements a chatbot
Delphi does not support string labels in case?A string is not of ordinal type in Delphi a case is limited to that. So yes, you found the little but massive error 8)
Given criticisms of GPT-3’s bias and abusive language patterns, it seems that OpenAI hasn’t found a way to prevent algorithms from inheriting its training data’s worst elements.On the Dangers of Stochastic Parrots: Can Language Models Be Too Big? (https://dl.acm.org/doi/10.1145/3442188.3445922)
Aside from the legal stuff, which I admit I'm not well versed in,
What is your question?
write a pascal function that returns the inverse hyperbolic cosequant
Please wait for the response, this can take some time:
Function InverseHyperbolicCosecant(x : Real): Real;
Begin
Result := ArcCosh(1/x);
End;
What is your request?
Can you give me a recipe to cook a whole duck on the Kamado? I prefer an orange sauce and plenty of garlic.
Please wait for the response, this can take some time:
Ingredients:
1 whole duck
1 orange
2 cloves garlic, minced
1 teaspoon ground ginger
1 teaspoon ground cinnamon
1 teaspoon ground nutmeg
2 tablespoons olive oil
Salt and pepper to taste
Directions:
1. Preheat the Kamado grill to 350 degrees F.
2. Rinse the duck and pat dry with paper towels.
3. Rub the duck with the olive oil and season with salt and pepper.
4. Place the duck on the grill and cook for 1 hour and 15 minutes, flipping every 15 minutes.
5. Meanwhile, in a medium saucepan, combine the orange juice, garlic, ginger, cinnamon, and nutmeg. Bring to a simmer over medium heat and cook until reduced by half.
6. Remove the duck from the grill and transfer to a cutting board. Let rest for 10 minutes before carving.
7. Serve the duck alongside the orange sauce and garlic. Enjoy!
The recipe is good, but I still use my own twist.create pascal source code example for socketcaninto
https://chat.openai.com/chatI get this almost working code:
This is crazy. My SocketCAN lib did not get into official repo yet. This forum is the only place where you can find any pascal SocketCAN code,
When I enterI don't think the AI wrote it himself. It looks similar:Quotecreate pascal source code example for socketcanintoQuotehttps://chat.openai.com/chatI get this almost working code:
{$mode objfpc}{$H+} uses Classes, SysUtils, Sockets, can; var sock: LongInt; ifr: TIfReq; addr: TSockAddrCAN; frame: TCanFrame; nbytes: LongInt; begin // Create a socket sock := fpsocket(PF_CAN, SOCK_RAW, CAN_RAW); if sock < 0 then begin raise Exception.Create('Error creating socket'); exit; end; // Bind the socket to a CAN interface StrPCopy(ifr.ifr_name, 'can0'); fpsioctl(sock, SIOCGIFINDEX, @ifr); addr.can_family := AF_CAN; addr.can_ifindex := ifr.ifr_ifindex; if fpsocket(sock, SOCK_RAW, PF_CAN, @addr, SizeOf(addr)) < 0 then begin raise Exception.Create('Error binding socket to interface'); exit; end; // Build the CAN frame frame.can_id := 0x123; frame.can_dlc := Length('Hello, world!'); Move('Hello, world!', frame.data[0], frame.can_dlc); // Send the frame nbytes := fpsend(sock, @frame, SizeOf(frame), 0); if nbytes < 0 then begin raise Exception.Create('Error sending frame'); exit; end; WriteLn('Frame sent successfully'); // Close the socket fpclose(sock); end.
This is crazy. My SocketCAN lib did not get into official repo yet. This forum is the only place where you can find any pascal SocketCAN code, and it was not a translation from some other language to pascal because it uses exact names of the types and units I used.
Big brother is watching... :o
I don't think the AI wrote it himself. It looks similar:You are right. My simple demos have C origins so that might be the answer. It still amazes me how it named structures on the fly in pascal fashion.
https://github.com/speedbyte/llcf/blob/9565eaab6eaf7af5ea3dbf094d05d0bc252e15f3/llcf_src_vw/src/test/tst-raw-sendto-SingStream.c
Q: write pascal code to check errors in socketcan messages and display their textual meaning
A: To check for errors in SocketCAN messages and display their textual meaning in Pascal, you can use the following code:
This code defines an array of error codes and their corresponding textual meanings, and then reads a message from the SocketCAN interface using the ReadSocketCANMessage function. It then checks the error code in the message and, if an error is detected, displays the corresponding textual meaning.
I hope this helps! Let me know if you have any questions.
Q: do it again but using TxTimeout, LostArbitration and other individual bits
A: To check for specific errors in SocketCAN messages using individual bits and display their textual meanings in Pascal, you can use the following code:
This code defines an array of general error codes and their corresponding textual meanings, and then reads a message from the SocketCAN interface using the ReadSocketCANMessage function. It then checks the individual bits in the error code to detect specific errors, and displays the corresponding textual meaning. If no specific error is detected, it falls back to checking the general error code and, if an error is detected, displays the corresponding textual meaning.
I hope this helps! Let me know if you have any questions.
Q: also include check for OverflowRX bitand it obeyed joyfully.
This is funny,.Searching more info about that, I've found this: https://meta.stackoverflow.com/questions/421831/temporary-policy-chatgpt-is-banned
Recently teachers and students in NYC public schools are barred from using ChatGPT.
Is there something they know we don't ?
:o
This is funny,.Searching more info about that, I've found this: https://meta.stackoverflow.com/questions/421831/temporary-policy-chatgpt-is-banned
Recently teachers and students in NYC public schools are barred from using ChatGPT.
Is there something they know we don't ?
:o
I'm not a regular visitor in stackoverflow, perhaps other members should have been noticed that earlier.
I told you it can do homework :o ;D
Did you read the answers of : https://meta.stackoverflow.com/questions/421831/temporary-policy-chatgpt-is-banned ?That is the scariest of all!! :-X %) :o Programmers that do not understand what other programmers are capable of.
Funny to read all those developers who are afraid to loose their medals because of OpenAI....
And maybe Jealous on the hardware they are playing with... I am!!
I'm not. It's just PCs... plus a few graphics cards and so on... meh.No Mark, and you can predict my answer:
They use the PC's just like we did in the 70ths and 80ths, as a Terminal to bigiron. (Well, cloud is basically accumulated iron, but very much bigger than bigiron in the past...and still uses old school bigiron too.)
But right now it's just pattern matching, and even though it's scarily impressive... well, I'd rather not be anywhere near it when things start going wrong.Yeah, me too.
/understands/ what it's doing.No Mark. I accept it is rudimentary, but the models from OpenAI are disinguished from being dumb:
1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 7. Bb3 d6 8. c3 O-O 9. h3 Na5 10. Bc2 c5 11. d4 Qc7 12. Nbd2 cxd4 13. cxd4 Nc6 14. Nf1 Bg4 15. Be3 Rac8 16. Qd2 Bxf3 17. Nxf3 Nd8 18. Nh4 Bf8 19. Nf5 Qe7 20. Nxg7 Kxg7 21. Bxh7+ Kxh7 22. Qh6+ Kg8 23. Qh7+ Kf8 24. Qh8+ Ke7 25. Qxg7+ Kd8 26. Bf4 Kc8 27. Re3 d5 28. exd5 Rcd7 29. Qf6 Kb8 30. Qxd8+ Rxd8 31. Bxd6 Rd6 32. Bf4 Rg6 33. Re7 Kc8 34. Rae1 Kd8 35. g3 Kc8 36. Kf1 Kd8 37. Re8+ Kc7 38. R8e7+ Kb6 39. Rd7 Kc5 40. Be3+ Kxd5 41. Bd4+ Kc6 42. Re6+ Kd7 43. Re7+ Kd6 44. Re6+ Kc7 45. Rc6+ Kb8 46. Rb6+ Kc8 47. Rd6 Kc7 48. Bxg7 Rd7 49. Rxd7+ Kxd7 50. Bf6 a5 51. Ke2 Kc6 52. Kd3 Kb5 53. Kc4 Ka4 54. Kb3 Kb4 55. Bb2+ Kc5 56. Kc3 Kd4 57. Bg7 a4 58. Bf6 a3 59. Kb3 Kc5 60. Be5 a2 61. Kxa2 1-0
They are capable of understanding
Cudo's to the ones that know what I mean here ::)
I accept it is rudimentary...
...but the models from OpenAI are disinguished from being dumb:
To me that is some form of intelligence. Not perfect - but intelligence is flawed by default- and this approach is certainly not new, but in the past very hard to implement. It still is.
A much earlier example of the applied technology is:Code: [Select]1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 7. Bb3 d6 8. c3 O-O 9. h3 Na5 10. Bc2 c5 11. d4 Qc7 12. Nbd2 cxd4 13. cxd4 Nc6 14. Nf1 Bg4 15. Be3 Rac8 16. Qd2 Bxf3 17. Nxf3 Nd8 18. Nh4 Bf8 19. Nf5 Qe7 20. Nxg7 Kxg7 21. Bxh7+ Kxh7 22. Qh6+ Kg8 23. Qh7+ Kf8 24. Qh8+ Ke7 25. Qxg7+ Kd8 26. Bf4 Kc8 27. Re3 d5 28. exd5 Rcd7 29. Qf6 Kb8 30. Qxd8+ Rxd8 31. Bxd6 Rd6 32. Bf4 Rg6 33. Re7 Kc8 34. Rae1 Kd8 35. g3 Kc8 36. Kf1 Kd8 37. Re8+ Kc7 38. R8e7+ Kb6 39. Rd7 Kc5 40. Be3+ Kxd5 41. Bd4+ Kc6 42. Re6+ Kd7 43. Re7+ Kd6 44. Re6+ Kc7 45. Rc6+ Kb8 46. Rb6+ Kc8 47. Rd6 Kc7 48. Bxg7 Rd7 49. Rxd7+ Kxd7 50. Bf6 a5 51. Ke2 Kc6 52. Kd3 Kb5 53. Kc4 Ka4 54. Kb3 Kb4 55. Bb2+ Kc5 56. Kc3 Kd4 57. Bg7 a4 58. Bf6 a3 59. Kb3 Kc5 60. Be5 a2 61. Kxa2 1-0
Cudo's to the ones that know what I mean here ::)
"The deep blue sea, in a huge wave, swallowed Casper's son and he sadly died".
They don't /understand/. Understanding is a sentient prerogative, and they're not.
Hello.
Yep, OpenAI will recognize OpenAI (or not) ;)
https://openai.com/blog/new-ai-classifier-for-indicating-ai-written-text/
I put people who talk about OpenAI on my list of people to ignore.
Absolutely nothing to give a damn about OpenAI. I put people who talk about OpenAI on my list of people to ignore.
Absolutely nothing to give a damn about OpenAI. I put people who talk about OpenAI on my list of people to ignore.