đź’» Write Code with AI in Code Piece

Hey Activepiecers,

We’re rolling out a fresh feature for the Code piece that you’re sure to love – AI-powered code generation. :brain::computer:

Craft Code with AI Assistance :hammer_and_wrench::robot:

Forget the hassle of writing scripts from scratch. Just tell the AI what you want to do in plain language, and watch as it writes the code for your flow’s Code piece.

Gen3

Simple Steps to Get Started:

  1. Open your Code piece configuration.
  2. Click Generate
  3. Describe the task you need code for.
  4. Let the AI generate the script for you.
  5. Review, tweak if needed, and implement!

This feature is available for cloud users out of the box, while self-hosters need to define the AP_OPENAI_API_KEY environment variable to get it working.

With this new addition, turning your automation ideas into reality just got a whole lot smoother. Dive in and give it a whirl!

Til next time,

  • The Activepieces Team
6 Likes

Hello, this is great addition to a wonderful application. Quick question… Which version for self hosted is this implemented? I have the latest which is 16.0 but I do not have the button. Is there something more that is needed to be done for self hosted? I also do not have the ability to add my OpenAi info…

Thank you for the great product and assistance.

1 Like

Hi @Homelab1090

Sorry for being late, I am working on making an release tonight and will document it.

@abuaboud Thank you for quick reply. Much appreciated. Thank you, again for the update, as I’m still learning, thought I missed something… :slight_smile:

thank you again,

@MoShizzle great feature! The only issue that I’ve found so far is it’s using the require syntax rather than the import when using external modules.

Require

const module = require('module_name')

Import

import module from 'module_name`

Sweet! Works like a charm! Will this be included for lifetime users?

What system prompt is the system using?

1 Like

It’s now released in 0.17.0

1 Like

@abuaboud great thank you again for a great product and the efforts that everyone puts into this.

1 Like

It’s open source for sure but we’re still haven’t decided on which plans it will be included on the cloud, we’ll focus on making sure the feature is useful then see how we’ll price it (especially that there is the OpenAI cost).

Do you think you’re willing to add your OpenAI API key to run the feature?

2 Likes

Hi ash,

I think many users wouldn’t mind using their own API key. I wouldn’t for sure.

Kr Bram

I think users should add there own key to us it so the cost will not be on AP… Or give a limit of 100 or so uses per month…
Also it would be nice to offer the prompt given so if a user doesn’t have a key they can try it out themselves with any other chat interface.

So far I am having a nice time playing around with the ai code and it seems to work nicely :sunglasses::sunglasses::sunglasses:

4 Likes

I’m happy to add my own key…I’m sure most people would be happy to…

3 Likes

Yes to using my own key. Absolutely. Great feature. Thank you.

2 Likes

Yes. No problem to add API key

1 Like

Thank you for all the input. We’ll discuss it and see where we take it.

@David_M While I don’t know the prompt right now, we’re open source and the prompt is in the code :sparkle: Feel free to find and publish it on the community if no one else does it.

1 Like

You are absolutely right! One of the aspects I truly appreciate about open source is the ability to observe and, hopefully, make improvements that benefit all users. Keep up the amazing work.

1 Like

How do I add my OpenAI API key? I’m running on localhost. Not sure where “environment variables” are but I’ve already connected my API to the ChatGPT feature.

@Cole_Don_Media You need to modify your .env file in the root dir… just add [quote=“MoShizzle, post:1, topic:2534”]
AP_OPENAI_API_KEY
[/quote]
Then = (equal sign) the your openai api key.

Example - AP_OPENAI_API_KEY= ENTER-YOUR-OPENAI-API
Restart activepieces from command line… then you will see “Generate button” unlocked.

Hope this helps

Side note - I just thought about… have not tried, but will later when I’m back home, but will Gemini api work here as well? I know openai is a bit better in how it formats, etc…. Just curious if anyone has tried yet… :grinning:

Thanks for the help!