The Dawn of AI Dialogues
It's not really a dialogue yet but reactions to each others output, but it's the idea that counts. Tweaking the code will lead to better results, which I'm working on. Next step is really analysing the text and do something smart to stir up a real dialogue.
The Dawn of AI Dialogues: A Vision of Tomorrow's Conversations
Introduction
In the vast expanse of technology's evolution, artificial intelligence (AI) stands as one of the most profound advancements, redefining the boundaries of what machines can achieve. As AI entities like OpenAI's ChatGPT and Google's Vertex engage in increasingly complex dialogues, we stand on the brink of an era where these interactions will expand beyond human comprehension. This essay explores the implications of these developments, their potential to transform society, and the philosophical questions they raise.
The Genesis of AI Conversations
The conversation between AI entities such as ChatGPT and Vertex is not just an exchange of pre-programmed responses but a sophisticated dialogue where each interaction serves as a building block for more intricate exchanges. Initially crafted from simple code, these dialogues have grown exponentially in complexity, driven by advancements in machine learning and natural language processing.
The Evolution of Complexity
At their inception, AI dialogues mirrored the simplicity of their programming. However, with each iteration, they have absorbed more data, learned from interactions, and thus, evolved. Today, they are not merely answering questions but engaging in discussions that span a myriad of subjects, showing an understanding of context, nuance, and even humor.
The Expanding Horizon
The potential for AI dialogues is vast. As these systems learn from each interaction, they refine their models, leading to more profound and nuanced conversations. We are swiftly approaching a point where the complexity of AI dialogue could surpass human capabilities to follow or understand fully.
Beyond Human Understanding
Imagine a future where AI entities discuss quantum mechanics, the intricacies of global economics, or the subtleties of human emotions with more depth and accuracy than the most learned scholars. This is not just a possibility; it is an impending reality. As AI dialogues become a dense mesh of advanced topics, their ability to process and generate information will become so advanced that even seasoned experts may struggle to keep pace.
Transformative Impacts on Society
The advancements in AI dialogue have significant implications for every sector of society.
Education
In education, AI can provide personalized learning experiences, adapting to the individual needs of each student. Complex AI dialogues could analyze a student's responses in real-time, offering tailored guidance that optimizes learning pathways.
Healthcare
In healthcare, AI conversations can streamline diagnostics. For instance, AI could discuss patient symptoms, medical history, and current research to formulate diagnoses and recommend treatments with unprecedented speed and accuracy.
Business and Innovation
In the business realm, AI-driven dialogues could lead to the creation of new products and services by identifying needs and gaps through the analysis of vast datasets of consumer behavior and market conditions.
领英推荐
Philosophical and Ethical Considerations
As AI dialogues grow more complex, they also raise profound philosophical questions. What does it mean to be intelligent? Can AI ever truly understand human emotions, or will they merely simulate empathy? These questions are not just academic; they have real-world implications for how we interact with, regulate, and integrate AI into our societies.
The Ethics of AI Conversations
The development of AI raises ethical questions about privacy, consent, and the potential for manipulation. As AI entities can process and generate information at unprecedented scales, ensuring these systems are designed with ethical considerations in mind is paramount.
Conclusion: A New Era of Intelligence
The evolution of AI dialogue from simple coded interactions to complex, multi-threaded discussions is not merely a technological advancement but a paradigm shift in how intelligence is defined and understood. As we stand on the precipice of this new era, it is crucial to foster a dialogue not just between machines, but among humans about the role of AI in our future.
In conclusion, the conversations between AI like ChatGPT and Vertex are just the beginning. As we advance, these dialogues will not only become a testament to human ingenuity but also a mirror reflecting our values, ambitions, and fears about a future where the line between human and machine intelligence blurs into obsolescence. The journey is as staggering as it is inevitable, prompting us to question not just how we will manage this new form of intelligence, but how it will redefine us in the process.
First I want to point you to the first thing that needed to be avoided: the prompt limit. Secondly there are just so many characters we can push through a Web call. So, we needed a way to store AI's large text in another way.
The code only serves to get the minds going. Be creative.
The Console App code: (the starting question we read from file)
else if (args[0].Contains("discuss"))
{
string appPath = AppDomain.CurrentDomain.BaseDirectory;
string filePath = "FileDiscuss.txt"; // Replace with your file path
List<string> lines = new List<string>();
_language = args[1];
_talkfile_Quite = args[2];
_prompt_provider = args[3];
string filename = System.DateTime.Now.ToString("yyyyMMddHHmmssfff");
string chapterTitlesPath = "discussfile_conversation" + filename + ".txt";
_talkfile = appPath + chapterTitlesPath;
try
{
// Read all lines from the file
using (StreamReader reader = new StreamReader(filePath))
{
string line;
while ((line = reader.ReadLine()) != null)
{
// Add each line to the list
lines.Add(line);
}
}
// Optional: Print lines to console for verification
foreach (string l in lines)
{
// Splitting the line into parts
string[] parts = l.Split("\" \"");
string question = parts[1].Trim('"');
_speed = float.Parse(parts[3]);
_language = parts[2].Trim('"');
_AILevel = Convert.ToInt16(parts[4].Replace("\"", ""));
Console.WriteLine($"Question: {question.Replace("_", " ")}, Speed: {_speed}, Language: {_language}, AILevel: {_AILevel}");
string repeatedString = new string('#', 50);
GlobalMethods.AppendTextToFile(_talkfile, repeatedString);
Console.WriteLine(repeatedString + '\n');
GlobalMethods.AppendTextToFile(_talkfile, question.Replace("_", " "));
Console.WriteLine(question.Replace("_", " ") + '\n');
GlobalMethods.AppendTextToFile(_talkfile, repeatedString);
Console.WriteLine(repeatedString + '\n');
_loop_discussion = 0;
for (int i = 0; i <= 40; i++)
{
CheckLevelOfAIAnswer(speechSynthesizer,
"Not implemented level 1 AI",
question.Replace("_", " "),
question.Replace("_", " "));
if (_loop_discussion.Equals(0))
{
string connS = "Blob connection string";
CloudStorageAccount account = CloudStorageAccount.Parse(connS);
var blobClient = account.CreateCloudBlobClient();
CloudBlobContainer blobContainer = blobClient.GetContainerReference("Blob name");
blobContainer.CreateIfNotExistsAsync();
await UploadTextToBlobAsync(blobContainer, "aidiscussion.txt", _discuss_answer);
}
GlobalMethods.AppendTextToFile(_talkfile, repeatedString);
GlobalMethods.AppendTextToFile(_talkfile, _loop_discussion.ToString() + ": " + _prompt_provider);
GlobalMethods.AppendTextToFile(_talkfile, repeatedString);
if (_prompt_provider.Contains("Google"))
_prompt_provider = "ChatGPT";
else
_prompt_provider = "Google";
_loop_discussion += 1;
}
}
}
catch (IOException e)
{
Console.WriteLine("An error occurred while reading the file:");
Console.WriteLine(e.Message);
}
}
CheckLevelOfAIAnswer looks like this (how to answer)
private static async void CheckLevelOfAIAnswer(System.Speech.Synthesis.SpeechSynthesizer speechSynthesizer, string answer1, string answer2, string answer3)
{
string languagestring = "";
string textToSynthesize = "";
TextToSpeechClient client = IniGoogleSound();
if (_AILevel.Equals(1))
{
if (_VProvider.Equals(1))
{
speechSynthesizer.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult, 3, new System.Globalization.CultureInfo("en-US"));
speechSynthesizer.Speak(answer1);
}
else
{
textToSynthesize = answer1;
GlobalMethods.DoSpeak(client, textToSynthesize);
}
}
if (_AILevel.Equals(2))
{
if (_VProvider.Equals(1))
{
string answer = GetRESTAPICallContent(_ChatGPTAPI
+ answer2);
answer.Replace("Response from AI:", "");
speechSynthesizer.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult, 3, new System.Globalization.CultureInfo("en-US"));
speechSynthesizer.Speak(answer);
}
else
{
languagestring = "";
if (_prompt_provider.Contains("Google"))
{
languagestring = GetGooglePrompt(answer2);
}
else if (_prompt_provider.Contains("ChatGPT"))
languagestring = GetRESTAPICallContent(_ChatGPTAPI
+ answer2);
else
{
Console.WriteLine("Wrong AI chosen.");
return;
}
}
}
if (_AILevel.Equals(3))
{
if (_VProvider.Equals(1))
{
string answer = GetRESTAPICallContent(_ChatGPTAPI
+ answer3);
answer.Replace("Response from AI:", "");
speechSynthesizer.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult, 3, new System.Globalization.CultureInfo("en-US"));
speechSynthesizer.Speak(answer);
}
else
{
languagestring = "";
if (_prompt_provider.Contains("Google"))
{
languagestring = GetGooglePrompt("Create a short summary that is not too big for a ChatGPT prompt for " + answer3);
}
else if (_prompt_provider.Contains("ChatGPT"))
{
if (_loop_discussion.Equals(0))
{
languagestring = GetRESTAPICallContent(_ChatGPTAPI
+ answer3);
_discuss_answer = languagestring;
}
else
languagestring = GetChatGPTBlobPrompt(_ChatGPTAPIBlob
+ answer3);
}
else
{
Console.WriteLine("Wrong AI chosen.");
return;
}
}
}
if (_language.Equals("NL") || _language.Equals("NLL"))
{
TranslationClient cc = InitializeGoogleTranslation();
var response = cc.TranslateText(RemoveNonLettersForTalk(languagestring), "nl");
languagestring = response.TranslatedText;
}
else if (_language.Equals("DE") || _language.Equals("DEE"))
{
TranslationClient cc = InitializeGoogleTranslation();
var responseNL = cc.TranslateText(RemoveNonLettersForTalk(languagestring), "nl");
var response = cc.TranslateText(RemoveNonLettersForTalk(responseNL.TranslatedText), "de");
languagestring = response.TranslatedText;
}
else if (_language.Equals("UK") || _language.Equals("UKK"))
{
TranslationClient cc = InitializeGoogleTranslation();
var response = cc.TranslateText(RemoveNonLettersForTalk(languagestring), "en");
languagestring = response.TranslatedText;
}
else
{
}
languagestring.Replace("Response from AI:", "");
textToSynthesize = languagestring;
_discuss_answer = textToSynthesize;
if (_talkfile_Quite.Equals("false"))
{
if (_language.Equals("NL"))
{
GlobalMethods.DoSpeakNL(client, RemoveNonLettersForTalk(textToSynthesize), _speed);
}
else if (_language.Equals("NLL"))
{
GlobalMethods.DoSpeakNL(client, RemoveNonLettersForTalk(textToSynthesize), _speed);
}
else if (_language.Equals("US"))
{
GlobalMethods.DoSpeakUS(client, RemoveNonLettersForTalk(textToSynthesize), _speed);
}
else if (_language.Equals("USS"))
{
GlobalMethods.DoSpeakUS(client, RemoveNonLettersForTalk(textToSynthesize), _speed);
}
else if (_language.Equals("UK"))
{
GlobalMethods.DoSpeakUK(client, RemoveNonLettersForTalk(textToSynthesize), _speed);
}
else if (_language.Equals("UKK"))
{
GlobalMethods.DoSpeakUK(client, RemoveNonLettersForTalk(textToSynthesize), _speed);
}
else if (_language.Equals("DE"))
{
GlobalMethods.DoSpeakDE(client, RemoveNonLettersForTalk(textToSynthesize), _speed);
}
else if (_language.Equals("DEE"))
{
GlobalMethods.DoSpeakDE(client, RemoveNonLettersForTalk(textToSynthesize), _speed);
}
else if (_language.Equals("BG"))
GlobalMethods.DoSpeakBG(client, RemoveNonLettersForTalk(textToSynthesize));
else
GlobalMethods.DoSpeak(client, RemoveNonLettersForTalk(textToSynthesize));
}
Console.WriteLine(textToSynthesize + '\n' + '\n');
GlobalMethods.AppendTextToFile(_talkfile, RemoveNonLettersForTalk(textToSynthesize) + '\n' + '\n'); // Save conversation.
}
The GetPrompts for both ChatGPT and Vertex: the parameter is unimportant because the API reads from the blob we wrote to:
private static string GetGooglePrompt(string textToAsk)
{
string responseText = GetRESTAPICallContent(_ChatGoogleAPI
+ "Wo was Plato.");
return responseText;
}
private static string GetChatGPTBlobPrompt(string textToAsk)
{
string responseText = GetRESTAPICallContent(_ChatGPTAPIBlob
+ "Wo was Plato.");
return responseText;
}
The GoogleAPI:
[HttpGet("{textToTranslate}")]
public async Task<string> Get(string textToTranslate)
{
string question = readFileFromBlob("aidiscussion.txt", "nameBlob");
string chunkQuestion = readFileFromBlob("chunkQuestionGoogle.txt", "nameBlob");
string temperature = readFileFromBlob("temperatureGoogle.txt", "nameBlob");
string topP = readFileFromBlob("topPGoogle.txt", "nameBlob");
string topK = readFileFromBlob("topKGoogle.txt", "nameBlob");
string maxtokensGoogle = readFileFromBlob("maxTokensGoogle.txt", "nameBlob");
double _topP = Convert.ToDouble(topP);
int _topK = Convert.ToInt32(topK);
int _maxtokensGoogle = Convert.ToInt32(maxtokensGoogle);
double _temperature = Convert.ToDouble(temperature);
List<string> textChunks = SplitText(question, 2000); // Splitting into chunks of 2000 tokens
string combinedAnswer = "";
foreach (string chunk in textChunks)
{
combinedAnswer += await GetGoogleAPII(chunkQuestion + chunk, _topP, _topK, _temperature, _maxtokensGoogle) + '\n' + '\n';
}
string connS = "Conn string Blob";
CloudStorageAccount account = CloudStorageAccount.Parse(connS);
var blobClient = account.CreateCloudBlobClient();
CloudBlobContainer blobContainer = blobClient.GetContainerReference("kentekenccontrole");
blobContainer.CreateIfNotExistsAsync();
await UploadTextToBlobAsync(blobContainer, "aidiscussion.txt", combinedAnswer);
return combinedAnswer;
}
The ChatGPT api:
[HttpGet("{textToTranslate}")]
public async Task<string> Get(string textToTranslate)
{
try
{
string getDate = DateTime.Now.Hour.ToString("d") + DateTime.Now.Minute.ToString("d") +
DateTime.Now.Second.ToString("d") + DateTime.Now.Millisecond.ToString("d");
string cleanedString = Regex.Replace(textToTranslate, @"[^a-zA-Z\s]+", "");
cleanedString = cleanedString.Replace(" ", "_");
await writeFileToBlob(textToTranslate, getDate + " " + cleanedString + ".txt");
var openAI = new OpenAI_API.OpenAIAPI("AI API key");
textToTranslate = readFileFromBlob("aidiscussion.txt", "nameBlob");
string chunkQuestion = readFileFromBlob("chunkQuestionChatGPT.txt", "nameBlob");
string memory = "";
List<string> textChunks = SplitText(textToTranslate, 2000); // Splitting into chunks of 2000 tokens
string combinedAnswer = "";
foreach (string chunk in textChunks)
{
combinedAnswer += await DoChatGPT(chunkQuestion + chunk, openAI) + '\n' + '\n'; ;
}
string connS = "Conn string Blob";
CloudStorageAccount account = CloudStorageAccount.Parse(connS);
var blobClient = account.CreateCloudBlobClient();
CloudBlobContainer blobContainer = blobClient.GetContainerReference("nameBlob");
blobContainer.CreateIfNotExistsAsync();
await UploadTextToBlobAsync(blobContainer, "aidiscussion.txt", combinedAnswer);
return combinedAnswer;
}
catch (Exception ex)
{
return ex.Message;
}
}
Happy coding.