Giter VIP home page Giter VIP logo

hal9's Introduction

Hal9: Create and Share Generative Apps

License: MIT Hal9 PyPi Downloads Hal9 JS Downloads GitHub star chart

Create and deploy generative (LLMs and diffusers) applications (chatbots and APIs) in seconds.

  • Open: Use any model (OpenAI, Llama, Groq, MidJourney) and any library like (LangChain, DSPy).
  • Intuitive: No need to learn app frameworks (Flask), simply use input() and print(), or write file to disk.
  • Scalable: Engineers can integrate your app with scalable technologies (Docker, Kubernetes, etc)
  • Powerful: Using an OS process (stdin, stdout, files) as our app contract, enables long-running agents, multiple programming languages, and complex system dependencies.

Focus on AI (RAG, fine-tuning, alignment, training) and skip engineering tasks (frontend development, backend integration, deployment, operations).

Getting started

Create and share a chatbot in seconds as follows:

pip install hal9

hal9 create chatbot
hal9 deploy chatbot

Notice that deploy needs a HAL9_TOKEN environment variable with an API token you can get from hal9.com/devs. You can use this token to deploy from your local computer, a notebook or automate from GitHub.

HAL9_TOKEN=H9YOURTOKEN hal9 deploy chatbot

The code inside /chatbot/app.py contains a "Hello World" chatbot that reads the user prompt and echos the result back:

prompt = input()
print(f"Echo: {prompt}")

We designed this package with simplicity in mind, the job of the code is to read input and write output, that's about it. That said, you can create chatbots that use LLMs, generate images, or even use tools that connect to databases, or even build websites and games!

Creation

By default hal9 create defaults to the --template echo template, but you can choose different ones as follows:

hal9 create chatbot-openai --template openai
hal9 create chatbot-groq --template groq

A template provides ready to use code with specific technologies and use cases. Is very popular to use OpenAI's ChatGPT-like template with --template openai, the code generated will look as follows:

import hal9 as h9
from openai import OpenAI

messages = h9.load("messages", [])
prompt = h9.input(messages = messages)

completions = OpenAI().chat.completions.create(model = "gpt-4", messages = messages, stream = True)

h9.complete(completions, messages = messages)
h9.save("messages", messages, hidden = True)

The Learn section explain in detail how this code works, but will provide a quick overview. The hal9 package contains a helper functions to simplify your generative AI code. You can choose to not use hal9 at all and use input() and print() statements yourself, or even sue tools like langchain. The h9.load() and h9.save() functions load and save data across chat sessions, our platform is stateless by default. The h9.input() function is a slim wrapper over input() that also stores the user input in the messages. Then h9.complete() is a helper function to help parse the completion results and save the result in messages. That's about it!

Development

To make changes to your project, open chatbot/ in your IDE and modify chatbot/app.py.

You can then run your project as follows:

hal9 run chatbot

If you customized your template with --template make sure to set the correct key, for example export OPENAI_KEY=YOUR_OPENAI_KEY.

You can then run your application locally with:

hal9 run chatbot

This command is just a convenience wrapper to running the code yourself with something like python app.py.

Deployment

The deploy command will prepare for deployment your generative app.

For example, you can prepare deployment as a generative app (Hal9). We have plans to also provide deployment to Docker and the open source community can expand this even further.

hal9 deploy chatbot --target hal9

Each command is tasked with preparing the deployment of your project folder. For example, --target docker should create a Dockerfile file that gets this project ready to run in cloud containers.

For personal use, --target hal9 supports a free tier at hal9.com; enterprise support is also available to deploy with --target hal9 --url hal9.yourcompany.com

hal9's People

Contributors

anchit-sadana avatar azeloc avatar brenda-lambert avatar emilianopp avatar g-m-e avatar gnykka avatar inaki321 avatar javierluraschi avatar kevinykuo avatar luisguillen03 avatar opinon1 avatar slugenj avatar snow-hare avatar soopyman avatar whitphx avatar williamorim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hal9's Issues

Function h9_heatmap_chart

I created this example to put in the website, but it didn't work

h9_create() |> h9_load(mtcars) |> h9_heatmap_chart( x = "mpg", y = "disp", value = "carb", palette = "schemePaired", fontsize = "16", marginleft = "40", marginbottom = "30" )

Upgrade BodyPix to use MoveNet

We used BodyPix in our pose estimation block cause we had an older prototype partially working, but MoveNet is a better model we should use instead.

Function h9_treemap_chart

I created this example to put in the website, but it didn't work

h9_create() |> h9_load(mtcars) |> h9_treemap_chart( label = "mpg", size = "hp", palette = "schemePaired", fontsize = "16", marginleft = "30", marginbottom = "40" )

Function h9_facets_chart

I created this example to put in the website, but it didn't work

h9_create() |> h9_load(mtcars) |> h9_facets_chart( x = "mpg", y = "hp", facets = "carb", color = "cyl", chartType = "dot", palette = "schemePaired" )

Need to make deps global

The block dependencies deps: are currently injected over each function, this works fine for some libraries like arquero, d3 and tidy.js; however, for tensorflow libraries, this model starts to break since we can no longer debug the funcitons.

Instead, I think we need to move deps: to be injected as global dependencies.

Add Timeseries block using LSTM

We already have an example that supports Timeseries prediction using an LSTM, see https://devel.hal9.ai/web/index.html?sharedPipeline=01_dd145d336eda54baa0b44e646d56dd51

However, this is very hard to use since it requires multiple blocks:

  • SMA: Simple Moving Average
  • Window: To group into n-20 steps
  • Training: A step to train the dataset
  • Predict: A step to predict future values

As a start, we should refactor all those blocks into a Timeseries block that performs SMA, Window, Training and Prediction in a single block.

Cumulative Sums

Would be useful to have a tool for creating cumulative totals (running sum)

Add support for a dropdown control

We would like to support more controls, we currently only have support for a website control: https://github.com/hal9ai/hal9ai/blob/main/scripts/controls/website.txt.js -- A dropdown control would allow users to customize visualizations and pipelines even when they are not using the Hal9 user interface.

The output of the control should be the name of the control. For instance, I should be able to name my control country and that would be the output of the block, such that a subsequent block can use the country parameters in an expression.

Notebook's pipeline should be collapsable

The pipeline steps should be collapsable to maximize space. When clicking a selected block, it should deselect (implemented) and also collapse the pipeline and show only an "expand" icon like "v". Ideally there should be an animation when the pipeline collapses to indicate the pipeline is still available.

Notebooks layout should not scroll

Notebooks layout should not scroll unless specified as an option with something like scroll = true.

We need to add support for a notebooks-specific layout that does not assume height: 100% but rather height: auto, see for instance attached image cutting off chart in the bottom:

Screen Shot 2022-06-06 at 4 26 51 PM

Support to deserialize dates

We deserialize cached data as follows:

const arqueroDeserialize = async (e) => {
  const aq = await arqueroRoot();
  return aq.table(JSON.parse(e.replace(/undefined/g, 'null')).data);
}

We need a mechanism to roundtrip the data type of each column. Otherwise, pipelines with dates, save as strings, and are read back as strings once the pipeline is rerun from cache.

Markdown problema

Hi, I am trying to add a markdown but the Markdown tab is not in the screen. I don't know how can I add it.

markd

Inserting a Linear Regression block throws an error.

The error thrown is Traceback (most recent call last): File "/hal9/worker/pyscript/0.9612170867734109/hal9code.py", line 86, in <module> 'stdout': typeserialize(stdout), NameError: name 'stdout' is not defined

Make bar chart selectable

We would like to add a "selectable" parameter to our bar chart that allows users to:

  • Select a single bar on click
  • Output a drilldown output for other blocks to use

Investigate potential difference in runtime between alpha and upcoming beta release

We should investigate why there is a difference in the alpha vs beta runtimes, maybe is not runtime related, but worth investigating:

Bumped up the number of rows to 1000000 in both pages' settings, and you can see in the .ai version that the 2012 orange is larger than the 2012 blue, but in the .com it's the opposite

Another difference: on the second barchart, the .ai version is two shades of blue, while the .com version is blue and orange

Function h9_error_chart

I created this example to put in the website, but it didn't work

h9_create() |> h9_load(mtcars) |> h9_error_chart( x = "carb", min = "mpg", max = "mpg", open = "vs", close = "cyl", levels = "carb", fontsize = "16", marginleft = "40", marginbottom = "30" )

Function h9_funnel_chart

I created this example to put in the website, but it didn't work

h9_create() |> h9_load(mtcars) |> h9_funnel_chart( stage = "mpg", value = "hp", label = "cyl", fontSize = "16", showPercentSelection = "true", funnelType = "2d", palette = "schemePaired" )

Function h9_plotly_chart

I created this example to put in the website, but it didn't work

h9_create() |> h9_load(mtcars) |> h9_plotly_chart( x = "mpg", y = "hp", chartType = "scatter", dataSizes = "5", palette = "schemePaired" )

Function h9_network_chart

I created this example to put in the website, but it didn't work

h9_create() |> h9_load(mtcars) |> h9_network_chart( from = "cyl", to = "carb" )

October Suggestions

Consider adding blocks to enable video/pose processing with something like:

  • Webcam
  • React Modules
  • Gaussian average of 3D space

Consider building a "clap detector":

  • YouTube / MP3 Import
  • Audio spectrogram to visualize claps

Function h9_dot_chart

I created this example to put in the website, but it didn't work

h9_create() |> h9_load(mtcars) |> h9_dot_chart( x = "carb", color = "cyl", palette = "schemePaired", dotsize = "3", ticks = "3", fontsize = "16", marginleft = "40", marginbottom = "30" )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.