DEV Community

tanya rai
tanya rai

Posted on • Edited on

Building with generative AI 🚀

TL;DR

In this tutorial, we'll show you how to streamline the way you integrate generative AI models into production!

LastMile AI - dev platform for generative AI 🚀

A quick background about LastMile AI. We are a developer platform for engineering teams to go from prototype to production with generative AI models. Our platform is multi-modal and model-agnostic so you aren't tied to dependencies on a single provider.

We recently launched our first open-source project AIConfig! Check us out and give us feedback ⭐️: https://github.com/lastmile-ai/aiconfig

Demo Video - https://www.youtube.com/watch?v=ej85StfHEFo

Image description

1. Let's get started

First, go to www.lastmileai.dev and sign in for free.

You'll land on an AI Workbook. AI Workbooks are a notebook-like interface where you can experiment text, image, and audio AI models from various providers. You can prototype and parametrize your prompt chains all in a single place.

empty_wb

2. Write your prompt chains

We are going to prototype a simple trip planner.

First prompt:

  1. Select 'ChatGPT' as model (should be default).
  2. Add global parameter 'city' with value 'London'.
  3. Name cell as 'get_activities'
  4. Write prompt 'Tell me the top 5 fun attractions in {{city}}'

first_prompt

For our second prompt:

  1. Add a new cell but change model to 'GPT4'.
  2. Add a local parameter for the cell {{cuisine}}.
  3. Add a system prompt to format the response (see image)
  4. Write prompt 'generate a one-day personalized itinerary based on 1/ my favorite cuisine: {{cuisine}}, 2/ list of activities: {{get_activities.output}}'

second_prompt

AI Workbook - https://lastmileai.dev/workbooks/clpdo3pnl019dpejj3kvl49g2

3. Download your AIConfig

AIConfig is a JSON serializable format that contains your prompts, model parameters, and settings. It is essentially your generative AI artifact to be managed in source control and easily shared across applications.

download_config

4. Use AIConfig in your application code

Here are a few of the python SDK commands on how you can use AIConfig easily in your application code.

But first why store your generative AI components in a config? It enables you to:

  • Decouple your application code from the generative AI components which decreases complexity
  • Manage your generative AI components in source control
  • Evaluate and monitor performance across models
  • Iterate fast - switch models and try different parameters

Colab Notebook: https://colab.research.google.com/drive/1RlGQmtR0uK7OTI5nG10E219JoH2mgAQr#scrollTo=Kd6BFPGiHPJe

Install python package

AIConfig SDK is available in python and Typescript.

install

Load your AI Config

load

Run your prompt

run

Run prompt with different parameter value

diff_params

Add a new prompt to your AIConfig

add_new

Save outputs in your AIConfig

save

AIConfig is our first open-source project and we'd love your help. See our contributing guidelines -- we would especially love help adding support for additional models that the community wants.
⭐️ https://github.com/lastmile-ai/aiconfig

Top comments (1)

Collapse
 
andrewlastmile profile image
andrew-lastmile

🔥