ChatGPT integration examples?

This forum is meant for examples of X# code.

User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

ChatGPT integration examples?

Post by wriedmann »

Hi Jonathan,
unfortunately today I will not have the time.... but I have my own account on ChatGPT.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
ArneOrtlinghaus
Posts: 412
Joined: Tue Nov 10, 2015 7:48 am
Location: Italy

ChatGPT integration examples?

Post by ArneOrtlinghaus »

What can be a sense for the user for having integrated ChatGBT?

I understand integrating specialized services like translation or maps and route finding.

Of course I can imagine an intelligent chat bot if this bot knows everything about the internals of my program. (It could be a nice task to train an own chat bot in the next years, may be with an intelligent assistent that learns automatically analyzing the running programs)

But it is difficult for me to find a value for users to integrate a chat bot without any context to the running program.

Arne
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

ChatGPT integration examples?

Post by FFF »

Well, it's "HOT" ;-)
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

ChatGPT integration examples?

Post by wriedmann »

Hi Arne,
my wife has integrated it in the correspondence service to help reception people formulate answers and descriptions. IMHO this makes sense.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Meinhard
Posts: 81
Joined: Thu Oct 01, 2015 4:51 pm

ChatGPT integration examples?

Post by Meinhard »

Arne,
I already love the upcoming discussion :)
Regards
Meinhard
jonhn
Posts: 86
Joined: Thu Feb 01, 2018 8:04 am
Location: New Zealand

ChatGPT integration examples?

Post by jonhn »

Arne, that's a good question. It *is* hot and trendy right now but I also think it is important we don't miss something that might be changing the world right in front of us. My use-case is as follows:

One of my applications is used by people supplying sound, lighting and audio-visual equipment for live events.
After they determine all the technical requirements from the customer they decide on the equipment and make up a quotation and proposal which they send to the customer in the form of an email. They include in the email body a brief description of the technical requirements and the equipment and what it will do for their event.

Since we have collected a lot of information: Venue name, customer name, date and time of the event, a theme and type of event (business meeting, sporting competition, educational, staff meeting, briefing, gala dinner, training, concert...) and a list of equipment we can form quite a reasonable prompt for ChatGPT to provide a 200-300 word summary of what they are getting and description of the services with some flavor to it.

When ready to generate the email the user can select a narration style, a tone, the "temperature" of the creativity from a drop-down list box and with all the aforementioned details, something (hopefully) intelligible and creative with less spelling and grammatical errors than they usually get in the hand-written effort should be regurgitated by the robot.
I think it could help with the wording for the proposal as well as the summary. It sure is not perfect yet, but let's get in and see where it does go.

It doesn't end there, of course. The interface is simple (should be, haha) and once this interface is working you have access to all the other AI's - to make drawings and with different capabilities. I think it is important.
If you have not had a look, here is a link to some of the models: https://platform.openai.com/docs/models/overview
User avatar
ArneOrtlinghaus
Posts: 412
Joined: Tue Nov 10, 2015 7:48 am
Location: Italy

ChatGPT integration examples?

Post by ArneOrtlinghaus »

Hi All,
thanks for all the answers.
Of course the topic is "hot". And also our company begins to speak about some AI-presence in our programs to our customers. So it may be worth to add ChatGPT in the programs for business reasons.

If you can already add a summary of much information, may be it is already worth adding something similar. I compare it with automatic translation of texts: It is difficult to get a good response when translating only one word. If a longer text including the word is added to that word, then the translators get much better.

I must also precise in which cases I think that ChatGPT may be useful:
- If it is used as a generator for ideas for the user and the user knows about the uncomplete or possibly misleading information of the response, then ChatGPT can be a nice possibility.
- If ChatGPT is used by users to get correct answers to something they want to know, then it may not be very useful.

Arne
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

ChatGPT integration examples?

Post by robert »

Hi folks,
I just asked ChatGPT:

Code: Select all

write a hello world program in X#
And this is what I got:
Unfortunately, X# is not a programming language that is widely known or used. However, assuming you are referring to the X# programming language that is designed for .NET Framework and .NET Core, here's an example of a "Hello, world!" program in X#:

Code: Select all

using System

class HelloWorld
   static method Main(args: array[string])
      Console.WriteLine("Hello, world!")
   endmethod
endclass
It is not perfect, but fairly close.
Does anybody know how to "train" ChatGPT?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

ChatGPT integration examples?

Post by wriedmann »

Hi Jonathan,
unfortunately RestSharp does not seem to encode the parameters correctly as JSON.
They are transmitted as follows:

Code: Select all

prompt=Hello%2C%20world!&max_tokens=5&n=1
If you change that this way:

Code: Select all

	var client 		:= RestSharp.RestClient{ "https://api.openai.com/v1" }
	var request 	:= RestSharp.RestRequest{ "/engines/text-davinci-002/completions", RestSharp.Method.POST }
	request:RequestFormat	:= RestSharp.DataFormat.Json
	request:AddHeader("Authorization", "Bearer <your-api-key>")
	request:AddHeader("Content-Type", "application/json")
	text to cBody
		{ "prompt" : "Hello, world!",
		  "max_tokens" : 5,
		  "n" : 1
		  }
	endtext
	request:AddJsonBody( cBody )

	var response := client:Execute(request)
	var content  := response:Content
it should work.
At least it returns the following error now:

Code: Select all

{
    "error": {
        "message": "You exceeded your current quota, please check your plan and billing details.",
        "type": "insufficient_quota",
        "param": null,
        "code": null
    }
}
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

ChatGPT integration examples?

Post by wriedmann »

Hi Jonathan,
maybe you should look at Fiddler from Telerik if you have to work with webservices: this tool intercepts the calls and shows you what is going for and back.
Personally I don't use any tool to do my interfaces to web services, only my own classes. So I don't have any dependencies that I don't like.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply