Jump to content

CoeurdeLeon

Members
  • Content Count

    47
  • Joined

  • Last visited

Everything posted by CoeurdeLeon

  1. CoeurdeLeon

    TGifImage TransparentColor

    How do I set the TransparentColor for a TGifImage? Thank you. Dick Maley
  2. CoeurdeLeon

    TGifImage TransparentColor

    Anders Thank you for your answer and for your many years of supporting the Delphi community. I was not aware of your blog. It is a treasure of information related to TGifImage. I have added it to my list of standard reference sources. Thank you. Dick Maley
  3. I am very interested. Email me at dickmaley@advdelphisys.com.
  4. CoeurdeLeon

    ChatGPT Example

    Does anyone have a working example where a connection is made with chatgpt, a question is asked and a response successfully returned. I have tried with both indy and ipworks components. I get a variety of errors. Here are 2 IPworks functions: Unit ads.ChatGpt; Interface Function ChatWithGPT(Const question, Api_Key: String): String; Function ChatWithGPT2(Const question, Api_Key: String): String; Implementation Uses ipwcore, ipwhttp, ipwrest, ipwtypes, System.SysUtils; Function ChatWithGPT(Const question, Api_Key: String): String; Var http : TIpwHttp; response: String; Begin http := TIpwHttp.Create(Nil); Try http.AddCookie('Authorization', 'Bearer ' + Api_Key); http.Get('https://api.openai.com/v1/chatgpt/chat?question=' + question); response := http.TransferredData; Result := response; Finally http.Free; End; End; Function ChatWithGPT2(Const question, Api_Key: String): String; Var rest : TipwREST; response: String; Begin rest := TipwREST.Create(Nil); Try rest.ContentType := 'application/json'; rest.OtherHeaders := 'Authorization: Bearer ' + Api_Key; rest.PostData := '{\"model\": \"text-davinci-003\", \"prompt\": \"" + question + "\", \"temperature\": 0, \"max_tokens\": 64}'; rest.Post('https://api.openai.com/v1/completions'); rest.XPath := '/json/choices/[1]/text'; response := rest.XText.Replace('\"', ''); Result := response; Finally FreeAndNil(rest); End; End; End. Richard Maley
  5. CoeurdeLeon

    Delphi job

    The job description can be found here. https://ncr.wd1.myworkdayjobs.com/en-US/ext_us/details/Software-Engineer-III_R0127327-3?q=delphi I applied about a month ago and have heard nothing. I would welcome a coding test. Where have all the Delphi jobs gone? Dick Maley
  6. CoeurdeLeon

    Anyone know why?

    The position in Frederick, Maryland is about 20 miles from my house. For the last 4 years this company has been advertising remote Delphi Developer positions working for the Legal & General America Headquarters located at 3275 Bennett Creek Ave in Frederick, MD 21704, United States. Many days I would receive 6 calls a day from different headhunters looking to fill this position. Frequently the connection is very bad (voip) and the indian accent is very difficult to understand. I have interviewed with one of the vendors trying to fill the position, Diverse Lynx. Eventually, I cut off all communications with this company because they appeared to be human traffickers and completely untrustworthy. I am a grey beard as was mentioned in one of the earlier posts. I could do the job with very little effort. Something is very fishy about this position in Frederick, MD. They are looking to fill the position for $50/hour. Dick Maley
  7. CoeurdeLeon

    Updated XMLMapper

    I fear the error is mine. The Beta package is 28.0.47741.2595 Launching XMLMapper from the tools menu and examining its about window I get The versions match. I was expecting to see the new filters on the left side. These are displayed when the schema view is selected. Miquel and Lars, thank you for your help. Dick Maley
  8. CoeurdeLeon

    Updated XMLMapper

    Miguel I have done just as you said And when I launch XMLMapper from the tools menu I get Is the new XMLMapper found someplace else? Dick Maley
  9. CoeurdeLeon

    Updated XMLMapper

    I have just finished upgrading to 11.3 and the first item I have installed is the new XMLMapper. I CANNOT FIND IT. All I can find is the old one. Where is it? Miguel, I really liked your recent webinar and look forward to your continued progress on this project. Dick Maley
  10. CoeurdeLeon

    Updated XMLMapper

    Will do
  11. CoeurdeLeon

    Updated XMLMapper

    Thank you Lars
  12. CoeurdeLeon

    SVG buttons in VCL or FMX

    Is there a simple way to use *.svg images in buttons in Delphi vcl or fmx applications? Thank you. Dick Maley
  13. CoeurdeLeon

    ChatGPT Example

    Thank you for all the responses. I would like to specially thank esegese (Sergio Gomez Cortijo). I was hoping to demonstrate a number of methods of connecting to chatGPT. However I have now modified that objective to connecting with GPT3. Listed below is a unit that either uses Indy or IPworks to query GPT3. The 3 functions work well for me and I hope they work for you. I had also wanted to have some functions that use the http get method, but none worked for me. Unit ads.Gpt3; Interface Function GPT3_IndyPostWithSSL(Const question, Api_Key: String): String; //Indy Post with SSL Function GPT3_IPWorks_PostWithRest(Const question, Api_Key: String): String; Function GPT3_IPWorksWithPost(Const question, Api_Key: String): String; Implementation Uses IdHttp, IdSSLOpenSSL, ipwcore, ipwhttp, ipwrest, ipwtypes, ipwxml, System.Classes, System.JSON, System.NetEncoding, System.SysUtils, Vcl.Dialogs, Vcl.Forms; Function GPT3_IndyPostWithSSL(Const question, Api_Key: String): String; //Indy Post with SSL Var http : TIdHTTP; JSON : TJSONValue; JSonArray: TJSonArray; PostData : String; SSL : TIdSSLIOHandlerSocketOpenSSL; Stream : TStringStream; Begin http := TIdHTTP.Create(Nil); SSL := TIdSSLIOHandlerSocketOpenSSL.Create(Nil); Try SSL.SSLOptions.Method := sslvTLSv1_2; http.IOHandler := SSL; http.Request.CustomHeaders.Add('Authorization: Bearer ' + Api_Key); http.Request.ContentType := 'application/json'; PostData := Format('{"model": "text-davinci-003","prompt": "%s","max_tokens": 2048,"temperature": 0}', [question]); Stream := TStringStream.Create(PostData); Try Result := http.Post('https://api.openai.com/v1/completions', Stream); JSON := TJSonObject.ParseJSONValue(Result).GetValue<TJSONValue>('choices'); Result := TJSonArray(JSON).Items[0].GetValue<TJSONString>('text').Value; Finally Stream.Free; End; Finally SSL.Free; http.Free; End; End; Function GPT3_IPWorks_PostWithRest(Const question, Api_Key: String): String; Var ipwrest: TipwREST; Begin ipwrest := TipwREST.Create(Nil); Try ipwrest.ContentType := 'application/json'; ipwrest.OtherHeaders := 'Authorization: Bearer ' + Api_Key; ipwrest.PostData := Format('{"model": "text-davinci-003","prompt": "%s","max_tokens": 2048,"temperature": 0}', [question]); Try ipwrest.Post('https://api.openai.com/v1/completions'); ipwrest.XPath := '/json/choices/[1]/text'; Result := ipwrest.XText; If Pos('"', Result) = 1 Then Result := Copy(Result, 2, Length(Result) - 1 + 1); If Copy(Result, Length(Result), 1) = '"' Then Result := Copy(Result, 1, Length(Result) - 1); If Copy(Result, 1, 4) = '\n\n' Then Result := Copy(Result, 5, Length(Result) - 5); Result := Trim(Result); Except On E: Exception Do ShowMessage(E.ClassName + ': ' + E.Message); End; Finally FreeAndNil(ipwrest); End; End; Function GPT3_IPWorksWithPost(Const question, Api_Key: String): String; Var http : TIpwHttp; response : String; JSON : TJSONValue; JSonArray: TJSonArray; Begin http := TIpwHttp.Create(Nil); Try Try http.ContentType := 'application/json'; http.OtherHeaders := 'Authorization: Bearer ' + Api_Key; http.PostData := Format('{"model": "text-davinci-003","prompt": "%s","max_tokens": 2048,"temperature": 0}', [question]); http.Post('https://api.openai.com/v1/completions'); response := http.TransferredData; JSON := TJSonObject.ParseJSONValue(response).GetValue<TJSONValue>('choices'); Result := TJSonArray(JSON).Items[0].GetValue<TJSONString>('text').Value; Except On E: Exception Do Result := 'Error: ' + E.Message; End; Finally FreeAndNil(http); End; End; End. Richard Maley
  14. CoeurdeLeon

    ChatGPT Example

    Esegece WOW!!! WOW!!! WOW!!! VERY GOOD!!! IT WORKS VERY WELL. Thank you. Richard Maley
  15. CoeurdeLeon

    ChatGPT Example

    Thank you. No I had not seen this. My only problem is I need to spend more money. And it is not completely clear what TMS product I need to buy. I have already spent a ton of money on Rad Studio Architect and IPWorks. I would like to get IPWorks or Indy working to save a buck. I do thank you for pointing out this solution. Richard Maley
  16. CoeurdeLeon

    ChatGPT Example

    I have 3 functions using IPWorks: Unit ads.ChatGpt; Interface Function ChatWithGPT(Const question, Api_Key: String): String; Function ChatWithGPT2(Const question, Api_Key: String): String; Function ChatWithGPT3(Const question, Api_Key: String): String; Implementation Uses chatgpt_p, ipwcore, ipwhttp, ipwrest, ipwtypes, System.SysUtils, System.NetEncoding; Function ChatWithGPT(Const question, Api_Key: String): String; Var http : TIpwHttp; response: String; Begin http := TIpwHttp.Create(Nil); Try http.AddCookie('Authorization', 'Bearer ' + Api_Key); http.Get('https://api.openai.com/v1/chatgpt/chat?question=' + question); response := http.TransferredData; Result := response; Finally http.Free; End; End; Function ChatWithGPT2(Const question, Api_Key: String): String; Var rest : TipwREST; response: String; Begin rest := TipwREST.Create(Nil); Try rest.ContentType := 'application/json'; rest.OtherHeaders := 'Authorization: Bearer ' + Api_Key; rest.PostData := '{\"model\": \"text-davinci-003\", \"prompt\": \"" + question + "\", \"temperature\": 0, \"max_tokens\": 64}'; rest.Post('https://api.openai.com/v1/completions'); rest.XPath := '/json/choices/[1]/text'; response := rest.XText.Replace('\"', ''); Result := response; Finally FreeAndNil(rest); End; End; Function ChatWithGPT3(Const question, Api_Key: String): String; Var http : TIpwHttp; response: String; Begin http := TIpwHttp.Create(Nil); Try http.OnSSLServerAuthentication:=frmchatgpt.ipwHTTP1SSLServerAuthentication; http.AddCookie('Authorization', 'Bearer ' + Api_Key); http.Get('https://api.openai.com/v1/chatgpt/chat?question=' + TNetEncoding.URL.Encode(question)); response := http.TransferredData; Result := response; Except on E: Exception do Result := 'Error: ' + E.Message; End; http.Free; End; End. The errors are as follows: Function ChatWithGPT(Const question, Api_Key: String): String; Function ChatWithGPT2(Const question, Api_Key: String): String; Function ChatWithGPT3(Const question, Api_Key: String): String; Richard Maley
  17. Can Rad Studio 11.1 and 11.2 coexist? Does Rad Studio 11.2 install over Rad Studio 11.1 or can the 2 versions both exist on the same computer? Thank you Dick Maley
  18. CoeurdeLeon

    Can Rad Studio 11.1 and 11.2 coexist?

    This was my fear. I invested so much time getting 11.1 perfect that I am inclined to wait for the next major release to upgrade. Thank you. Dick Maley
  19. CoeurdeLeon

    DelphiCon 2021 Code Examples

    I attended DelphiCon 2021 and enjoyed it very much, however I cannot find any of the example projects. Are the example projects published and if so where? Thank you Dick Maley
  20. CoeurdeLeon

    DelphiCon 2021 Code Examples

    Does anyone have more presenter code samples from DelphiCon 2021?
  21. CoeurdeLeon

    DelphiCon 2021 Code Examples

    Thank you David.
  22. CoeurdeLeon

    DelphiCon 2021 Code Examples

    Peter That is disappointing that there is not a central location where all presenters can save their code examples and attendees can retrieve this code. If anyone has more urls for DelphiCon 2021 code please respond with the urls. Thank you. Dick Maley
×