✅ How to work with Python A.I.'s
Ok, although I'm no where near ready to start writing my first line of code, I do want to get an idea of what I'm getting myself into. I'm building the A.I. in python and I'll be building an Avalonia desktop application that will interact with the A.I.
What I'm wondering is if there are any libraries, or other, that anyone recommends that would go great with this idea? Thanks.
25 Replies
It will be much easier to keep everything in the same language tbh
So I'd recommend you write the UI in Python as well. Tkinkter or whatever other Python UI library
oh ok. that makes sense
You could try to setup your python Ai handler as a FLASK app and then make api to it from your GUI
However, if you plan on shipping this to anyone prepare for a ton of issues cause python never "just runs" on a client machine
no no no shipping lol it's being made specifically to me. The end goal is to have a UI that I can put what I want into a text box with specific keywords in my statement so like
create a new avalonia desktop application named MyApp using the CommunityToolkit.Mvvm package instead of the Avalonia.ReactiveUI package and use the file structure for a multi-app editor setup
create a new avalonia desktop application
dotnet new avalonia.mvvm -n MyApp -o MyApp
using the CommunityToolkit.Mvvm package instead of the Avalonia.ReactiveUI package⚠️after everything else is done
cd MyApp && dotnet remove package Avalonia.ReactiveUI && dotnet add package CommunityToolkit.Mvvm
and use the file structure for a multi-app editor setupthis is where it would build the file structure that another user here gave me. Name escapes me and then it would cd into the Desktop application project under
./src
and add/remove the packages. I'll likely set it up too to prompt me if there are anymore packages with hints like databases and api's so that I don't forget them 😂If you really do want to go with 2 seperate languages I'd recommend the REST approach as it's the simplest to connect things that aren't directly related
as in java script? that would be a nice approach for the mobile app version of this little guy. the desktop version, I'm going to use the same language to build the AI. I just don't know how I'm going to get a flat line across the ui page and then make that line dance around all erratic when the ai speaks a respnose lol
which to be fair, I don't know how to do that in any language
Why Javascript?
that was the language that came to mind
There are quite a few mistakes showing in your statements. 1) Mixing multiple languages won't give you any real benefits, as you won't be able to master all of them quickly. 2) What's the AI you referred to? AI models like GPT have so many wrappers, so you can easily use a wrapper for .NET, such as Semantic Kernel from Microsoft. 3) Avalonia UI can take you anywhere, desktop, mobile and web, so focus on one thing like desktop first, and stop bothering yourself with mobile/web at this stage.
also, expecting a LLM to give you any serious code is a mistake to begin with
it would be faster to follow your instructions as you wrote them here than try and goad a LLM into producing the same output
"multi-app editor setup" is ambiguous even for a human person, i certainly wouldn't know exactly what you meant by that without an example
the most use i get out of LLMs in terms of codegen is repeating existing patterns in my code, and even then it gets it wrong too often to trust
ok so after a lengthy conversation with my friend last night, I used the wrong term. apologies. I'm techincally just creating a bunch of functions that make the different types of projects that I create and work with on my personal computer, so, not an a.i., but a small assistant program, and I've negated the use case for it on mobile so it's just going to be a desktop app
so basically it'll just be a private piece of software that I made that will have buttons and inputs that I'll nagivate to create the project I'm wanting instead of having to do all of the manual stuff
thanks for the help though you guys!
can you not already do this with custom .NET project templates?
Custom templates for dotnet new - .NET CLI
Learn about custom templates for any type of .NET project or files.
ok so I know nothing about templates. Templates aren't a bad idea, however, I'm making the program more personal as it's just being built for me. I did try and go the node.js route with doing it so that I could just run
npm create_project
in the terminal, however, I wasn't as successful at it as I thought I would be lolmy point is mostly don't reinvent the wheel, if the environment you're in has a project template feature it would be better to use that than to start from scratch
afaik IDEs pull these templates in as well so you'll see them in the relevant options when creating projects there
I got you. On a separate note of the assistant that I'm building, I want it to be able to speak it's responses to me like alexa does. I know how to make python speak using
pyttsx3
, however, I've never done that in C#. Is it possible?probably, find an API that does that and use a C# library to talk to it
https://learn.microsoft.com/en-us/dotnet/api/system.speech.synthesis.speechsynthesizer.speak?view=dotnet-plat-ext-8.0 what about this?
SpeechSynthesizer.Speak Method (System.Speech.Synthesis)
Generates speech output synchronously from a string, a Prompt object, or a PromptBuilder object.
I'm just doing research on it for now, however, my end goal is to have a small image of my favorite seven deadly sins character be in the corner of the desktop app, and when they speak, it'll speak their responses outloud, and write them into a chat box icon
but how does client run both gui and api?
running 2 separate app sounds like it would work weird
Your GUI runs the api on a hidden CLI task
I made a renderer / encoder for Media that calls on a core written in batch
so i also have to check every possible way of quiting my gui app, so api can also be stopped properly
Alternatively you catch the event of the program closing and then killing your api process with it
C# can do that.
alr
But note that your time is limited
You can still run code when your program closes but you have very limited time to do so