Code Monkey home page Code Monkey logo

droidcon-sf-23's Introduction

LLM chat demo for Android (using OpenAI)

This repo was originally created for a talk at droidcon SF 2023. The session page has details of what was presented.

The chat demo is based on the Jetpack Compose Jetchat sample from Google.

Screenshot showing chat using the favorites functions

You'll need to add various service keys to Constants.kt to light everything up:

  • jetchat-ai - open chat with weather function. Start message with "image of" to generate a picture.
  • droidcon-chat - guided chat with embeddings and functions based on the droidcon SF conference schedule.
  • There's also a PaLM-based chat channel hiding in there too ๐Ÿ˜‰

History/documentation

The Jetchat-AI demo has been built up over a few months to be a 'first principles' demonstration of incorporating an LLM chat into an Android app using Kotlin. Over time it has grown to include image generation API, function calling, embeddings and RAG pattern, sliding window for token limit, and conversation memory.

Blogpost Notes
Jetchat with OpenAI on Android Build an OpenAI-powered chat with the Jetchat Jetpack Compose sample using the chat and image APIs
JetchatAI improvements: error handling and animations Add error handling and useability tweaks to JetchatAI
JetchatAI gets smarter with embeddings Generate embeddings for an entire conference so we can chat about the schedule
OpenAI chat functions on Android Implement the canonical getWeather chat function in Kotlin
Coming OpenAI function calls with embeddings Add date/time grounding and implement functions to return conference info by time
Chat memory with OpenAI functions Add a Sqlite database to store 'favorite sessions' and implement chat functions to store, delete, and retrieve the favorites list
Embedding vector caching Store embedding vectors in Sqlite on device
Dynamic Sqlite queries with OpenAI chat functions Implement the canonical askDatabase chat function using a simple conference sessions schema
Prompt engineering tips Some prompt engineering lessons learned on the JetchatAI project
OpenAI and token limits Brief discussion on tokens which leads into the next few posts on managing limited context
Infinite chat using a sliding window Avoid token limit errors with a sliding window on the chat history
De-duplicating context in the sliding window Make the sliding window a little more efficient by removing duplicate grounding info
"Infinite" chat with history summarization Squeeze more historical context in by summarizing the oldest messages to fit more in the window
Infinite chat with history embeddings Create embeddings of the messages to act as conversation memory

droidcon-sf-23's People

Contributors

conceptd3v avatar khalp avatar conceptdev avatar

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.