Skip to content

Commit

Permalink
Merge branch 'CambioML:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
llauraa23 authored Oct 9, 2023
2 parents fc5cb49 + 2d65f0a commit eb18e32
Show file tree
Hide file tree
Showing 27 changed files with 675 additions and 449 deletions.
13 changes: 9 additions & 4 deletions example/chatbot/demo_launch_app_cpu_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,29 @@
You can follow [the installation guide](https://github.com/CambioML/pykoi/tree/install#option-1-rag-cpu)
to set up the environment.
- Run the demo:
1. Enter your OpenAI API key in the `api_key` below.
1. Enter your OpenAI API key a .env file in the `~/pykoi` directory with the name OPEN_API_KEY, e.g.
```
OPENAI_API_KEY=your_api_key
```
2. On terminal and `~/pykoi` directory, run
```
python -m example.chatbot.demo_launch_app_cpu_openai
```
"""
import os

from dotenv import load_dotenv

from pykoi import Application
from pykoi.chat import ModelFactory
from pykoi.chat import QuestionAnswerDatabase
from pykoi.component import Chatbot, Dashboard


##########################################################
# Creating an OpenAI model (requires an OpenAI API key) #
##########################################################
# enter openai api key here
api_key = "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"
load_dotenv()
api_key = os.getenv("OPENAI_API_KEY")

# Creating an OpenAI model
model = ModelFactory.create_model(
Expand Down
22 changes: 15 additions & 7 deletions example/comparator/demo_model_comparator_cpu_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,34 @@
Demo for the chatbot application using multiple OpenAI models.
- Prerequisites:
To run this jupyter notebook, you need a `pykoi` environment with the `rag` option.
You can follow [the installation guide](https://github.com/CambioML/pykoi/tree/install#option-1-rag-cpu)
to set up the environment.
To run this jupyter notebook, you need a `pykoi` environment with the `rag` option.
You can follow [the installation guide](https://github.com/CambioML/pykoi/tree/install#option-1-rag-cpu)
to set up the environment.
- Run the demo:
1. Enter your OpenAI API key in the `api_key` below.
2. On terminal and `~/pykoi` directory, run
1. Enter your OpenAI API key a .env file in the `~/pykoi` directory with the name OPEN_API_KEY, e.g.
```
OPENAI_API_KEY=your_api_key
```
2. On terminal and `~/pykoi` directory, run
```
python -m example.comparator.demo_model_comparator_cpu_openai
```
"""

import os

from dotenv import load_dotenv

from pykoi import Application
from pykoi.chat import ModelFactory
from pykoi.component import Compare


##########################################################
# Creating an OpenAI model (requires an OpenAI API key) #
##########################################################
# enter openai api key here
api_key = ""
load_dotenv()
api_key = os.getenv("OPENAI_API_KEY")

# Creating an OpenAI model
openai_model_1 = ModelFactory.create_model(
Expand Down
2 changes: 1 addition & 1 deletion pykoi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from pykoi.application import Application

__version__ = "0.0.7"
__version__ = "0.0.9"
Loading

0 comments on commit eb18e32

Please sign in to comment.