Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: embedchain cookbook #77

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions embedchain-qa/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import os

import chainlit as cl

from embedchain import App

os.environ["OPENAI_API_KEY"] = "OPENAI_API_KEY"


@cl.on_chat_start
async def on_chat_start():
app = App.from_config(
config={
"app": {"config": {"name": "chainlit-app"}},
"llm": {
"config": {
"stream": True,
"model": "gpt-3.5-turbo-16k",
"temperature": 0.5,
"max_tokens": 4000,
}
},
}
)
# import your data here
app.add("https://docs.chainlit.io/",data_type="docs_site")
app.collect_metrics = True
cl.user_session.set("app", app)


@cl.on_message
async def on_message(message: cl.Message):
app = cl.user_session.get("app")
msg = cl.Message(content="")
for chunk in await cl.make_async(app.chat)(message.content):
await msg.stream_token(chunk)

await msg.send()
14 changes: 14 additions & 0 deletions embedchain-qa/chainlit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Welcome to Chainlit! 🚀🤖

Hi there, Developer! 👋 We're excited to have you on board. Chainlit is a powerful tool designed to help you prototype, debug and share applications built on top of LLMs.

## Useful Links 🔗

- **Documentation:** Get started with our comprehensive [Chainlit Documentation](https://docs.chainlit.io) 📚
- **Discord Community:** Join our friendly [Chainlit Discord](https://discord.gg/k73SQ3FyUh) to ask questions, share your projects, and connect with other developers! 💬

We can't wait to see what you create with Chainlit! Happy coding! 💻😊

## Welcome screen

To modify the welcome screen, edit the `chainlit.md` file at the root of your project. If you do not want a welcome screen, just leave this file empty.
27 changes: 27 additions & 0 deletions embedchain-qa/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Chainlit App

## Overview

This cookbooks contains a Chainlit app that uses the `embedchain-qa` model to answer questions based on a given context. The app is built using the Chainlit SDK and can be integrated into your existing Python codebase.


## Installation

To get started with this Chainlit app, you will need Python installed on your system. Follow these steps:

1. Clone the repository: `git clone https://github.com/Chainlit/cookbook/{cookbook-name}`

2. Navigate to the `chainlit-cookbook/{cookbook-name}` directory.

3. perform the following command to install the required dependencies:

```bash
pip install -r requirements.txt
```

4. Run the app using the following command:

```bash
chainlit run app.py
```
Make sure to add your openai API key to the `app.py` file before running the app.