Fix issue with model defaults and bump version
This commit is contained in:
parent
68cd7d7dda
commit
2f2cdabd2d
8 changed files with 83 additions and 49 deletions
4
Makefile
4
Makefile
|
|
@ -51,3 +51,7 @@ docker-update-latest: docker-buildx-prepare
|
||||||
|
|
||||||
# Release with latest
|
# Release with latest
|
||||||
docker-release-all: docker-release docker-update-latest
|
docker-release-all: docker-release docker-update-latest
|
||||||
|
|
||||||
|
|
||||||
|
dev:
|
||||||
|
docker compose -f docker-compose.dev.yml up --build
|
||||||
23
README.md
23
README.md
|
|
@ -29,7 +29,7 @@ services:
|
||||||
open_notebook:
|
open_notebook:
|
||||||
image: lfnovo/open_notebook:latest
|
image: lfnovo/open_notebook:latest
|
||||||
ports:
|
ports:
|
||||||
- "8502:8502"
|
- "8080:8502"
|
||||||
env_file:
|
env_file:
|
||||||
- ./docker.env
|
- ./docker.env
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
@ -52,16 +52,29 @@ Go to the [Usage](docs/USAGE.md) page to learn how to use all features.
|
||||||
|
|
||||||
|
|
||||||
- **Multi-Notebook Support**: Organize your research across multiple notebooks effortlessly.
|
- **Multi-Notebook Support**: Organize your research across multiple notebooks effortlessly.
|
||||||
- **Broad Content Integration**: Works with links, PDFs, TXT files, PowerPoint presentations, YouTube videos, and pasted text (audio/video support coming soon).
|
- **Multi-model support**: Open AI, Anthropic, Gemini, Vertex AI, Open Router, Ollama.
|
||||||
|
- **Podcast Generator**: Automatically convert your notes into a podcast format.
|
||||||
|
- **Broad Content Integration**: Works with links, PDFs, EPUB, Office, TXT, Markdown files, YouTube videos, Audio files, Video files and pasted text.
|
||||||
- **AI-Powered Notes**: Write notes yourself or let the AI assist you in generating insights.
|
- **AI-Powered Notes**: Write notes yourself or let the AI assist you in generating insights.
|
||||||
- **Recursive Summarization**: Tackle large content by recursively summarizing it.
|
|
||||||
- **Integrated Search Engines**: Built-in full-text and vector search for faster information retrieval.
|
- **Integrated Search Engines**: Built-in full-text and vector search for faster information retrieval.
|
||||||
- **Fine-Grained Context Management**: Choose exactly what to share with the AI to maintain control.
|
- **Fine-Grained Context Management**: Choose exactly what to share with the AI to maintain control.
|
||||||
- **Podcast Generator**: Automatically convert your notes into a podcast format.
|
|
||||||
- **Multi-model support**: Open AI, Anthropic, Gemini, Vertex AI, Open Router, Ollama.
|
|
||||||
|
|
||||||
## 🚀 New Features
|
## 🚀 New Features
|
||||||
|
|
||||||
|
### v0.0.7 - Model Management 🗂️
|
||||||
|
|
||||||
|
- Manage your AI models and providers in a single interface
|
||||||
|
- Define default models for several tasks such as chat, transformation, embedding, etc
|
||||||
|
- Enabled support for Embedding models from Gemini, Vertex and Ollama
|
||||||
|
|
||||||
|
### v0.0.6 - ePub and Office files support 📄
|
||||||
|
|
||||||
|
You can now process ePub and Office files (Word, Excel, PowerPoint), extracting text and insights from them. Perfect for books, reports, presentations, and more.
|
||||||
|
|
||||||
|
### v0.0.5 - Audio and Video support 📽️
|
||||||
|
|
||||||
|
You can now process audio and video files, extracting transcripts and insights from them. Perfect for podcasts, interviews, lectures, and more.
|
||||||
|
|
||||||
### v0.0.4 - Podcasts 🎙️
|
### v0.0.4 - Podcasts 🎙️
|
||||||
|
|
||||||
You can now build amazing custom podcasts based on your own data. Customize your speakers, episode structure, cadence, voices, etc.
|
You can now build amazing custom podcasts based on your own data. Customize your speakers, episode structure, cadence, voices, etc.
|
||||||
|
|
|
||||||
20
app_home.py
20
app_home.py
|
|
@ -1,9 +1,13 @@
|
||||||
import streamlit as st
|
import streamlit as st
|
||||||
|
|
||||||
from open_notebook.config import DEFAULT_MODELS
|
|
||||||
from open_notebook.database.migrate import MigrationManager
|
from open_notebook.database.migrate import MigrationManager
|
||||||
|
|
||||||
|
# from open_notebook.config import DEFAULT_MODELS
|
||||||
|
from open_notebook.domain.models import DefaultModels
|
||||||
from stream_app.utils import version_sidebar
|
from stream_app.utils import version_sidebar
|
||||||
|
|
||||||
|
default_models = DefaultModels.load()
|
||||||
|
|
||||||
version_sidebar()
|
version_sidebar()
|
||||||
mm = MigrationManager()
|
mm = MigrationManager()
|
||||||
if mm.needs_migration:
|
if mm.needs_migration:
|
||||||
|
|
@ -13,27 +17,25 @@ if mm.needs_migration:
|
||||||
st.success("Migration successful")
|
st.success("Migration successful")
|
||||||
st.rerun()
|
st.rerun()
|
||||||
elif (
|
elif (
|
||||||
not DEFAULT_MODELS.default_chat_model
|
not default_models.default_chat_model
|
||||||
or not DEFAULT_MODELS.default_transformation_model
|
or not default_models.default_transformation_model
|
||||||
):
|
):
|
||||||
st.warning(
|
st.warning(
|
||||||
"You don't have default chat and transformation models selected. Please, select them on the settings page."
|
"You don't have default chat and transformation models selected. Please, select them on the settings page."
|
||||||
)
|
)
|
||||||
st.stop()
|
elif not default_models.default_embedding_model:
|
||||||
elif not DEFAULT_MODELS.default_embedding_model:
|
|
||||||
st.warning(
|
st.warning(
|
||||||
"You don't have a default embedding model selected. Vector search will not be possible and your assistant will be less able to answer your queries. Please, select one on the settings page."
|
"You don't have a default embedding model selected. Vector search will not be possible and your assistant will be less able to answer your queries. Please, select one on the settings page."
|
||||||
)
|
)
|
||||||
st.stop()
|
elif not default_models.default_speech_to_text_model:
|
||||||
elif not DEFAULT_MODELS.default_speech_to_text_model:
|
|
||||||
st.warning(
|
st.warning(
|
||||||
"You don't have a default speech to text model selected. Your assistant will not be able to transcribe audio. Please, select one on the settings page."
|
"You don't have a default speech to text model selected. Your assistant will not be able to transcribe audio. Please, select one on the settings page."
|
||||||
)
|
)
|
||||||
elif not DEFAULT_MODELS.default_text_to_speech_model:
|
elif not default_models.default_text_to_speech_model:
|
||||||
st.warning(
|
st.warning(
|
||||||
"You don't have a default text to speech model selected. Your assistant will not be able to generate audio and podcasts. Please, select one on the settings page."
|
"You don't have a default text to speech model selected. Your assistant will not be able to generate audio and podcasts. Please, select one on the settings page."
|
||||||
)
|
)
|
||||||
elif not DEFAULT_MODELS.large_context_model:
|
elif not default_models.large_context_model:
|
||||||
st.warning(
|
st.warning(
|
||||||
"You don't have a large context model selected. Your assistant will not be able to process large documents. Please, select one on the settings page."
|
"You don't have a large context model selected. Your assistant will not be able to process large documents. Please, select one on the settings page."
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ or the shourcut
|
||||||
make run
|
make run
|
||||||
```
|
```
|
||||||
|
|
||||||
## Setting up the providers
|
## Setting up the providers and models
|
||||||
|
|
||||||
Several new providers are supported now:
|
Several new providers are supported now:
|
||||||
|
|
||||||
|
|
@ -120,30 +120,33 @@ All providers are installed out of the box. All you need to do is to setup the e
|
||||||
|
|
||||||
Please refer to the `.env.example` file for instructions on which ENV variables are necessary for each.
|
Please refer to the `.env.example` file for instructions on which ENV variables are necessary for each.
|
||||||
|
|
||||||
### Use provider-modelname convention
|
### Create models on the Settings page
|
||||||
|
|
||||||
You should prepend the provider name to the model_name when setting up your env variables, examples:
|
Go to the settings page and create your different models.
|
||||||
|
|
||||||
- openai/gpt-4o-mini
|
| Model Type | Supported Providers |
|
||||||
- anthropic/claude-3-5-sonnet-20240620
|
|------------|-----------|
|
||||||
- ollama/gemma2
|
| Language | OpenAI, Anthropic, Open Router, LiteLLM, Vertex AI, Vertex AI, Anthropic, Gemini, Ollama |
|
||||||
- openrouter/nvidia/llama-3.1-nemotron-70b-instruct
|
| Embedding | OpenAI, Gemini, Vertex AI, Ollama |
|
||||||
- vertexai/gemini-1.5-flash-001
|
| Speech to Text | OpenAI |
|
||||||
- gemini/gemini-1.5-flash-001
|
| Text to Speech | OpenAI, ElevenLabs |
|
||||||
|
|
||||||
__There will be a UI configuration for models in the coming days.__
|
|
||||||
|
|
||||||
## Setup 2 models for more flexibility
|
> 📝 **Notice:** For complete usage of all the features, you need to setup at least 4 models (one of each type).
|
||||||
|
|
||||||
There are 2 configurations for models at this point:
|
After setting up the models, head to the Model Defaults tab to define the default models. There are several defaults to setup.
|
||||||
|
|
||||||
```
|
|
||||||
DEFAULT_MODEL="openai/gpt-4o-mini"
|
|
||||||
SUMMARIZATION_MODEL="openrouter/nvidia/llama-3.1-nemotron-70b-instruct"
|
|
||||||
```
|
|
||||||
|
|
||||||
- **DEFAULT_MODEL** is used by the chat tool
|
| Model Default | Purpose |
|
||||||
- **SUMMARIZATION_MODEL (optional)** is used on the content summarization
|
|------------|-----------|
|
||||||
|
| Chat Model | Will be used on all chats |
|
||||||
|
| Transformation Model | Will be used for summaries, insights, etc |
|
||||||
|
| Large Context | For content higher then 110k tokens (use Gemini here) |
|
||||||
|
| Speech to Text | For transcribing text from your audio/video uploads |
|
||||||
|
| Text to Speech | For generating podcasts |
|
||||||
|
| Embedding | For creating vector representation of content |
|
||||||
|
|
||||||
|
All model types and defaults are required for now. If you are not sure which to pick, go with OpenAI, the only one that covers all possible model types.
|
||||||
|
|
||||||
The reason for opting for this route is because different LLMs, will behave better/worse depending on the type of request and type of tools offered. So it makes sense to build a more refined system to decide which model should process which task.
|
The reason for opting for this route is because different LLMs, will behave better/worse depending on the type of request and type of tools offered. So it makes sense to build a more refined system to decide which model should process which task.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,16 @@ os.makedirs(PODCASTS_FOLDER, exist_ok=True)
|
||||||
|
|
||||||
DEFAULT_MODELS = DefaultModels.load()
|
DEFAULT_MODELS = DefaultModels.load()
|
||||||
|
|
||||||
EMBEDDING_MODEL = get_model(
|
if DEFAULT_MODELS.default_embedding_model:
|
||||||
DEFAULT_MODELS.default_embedding_model, model_type="embedding"
|
EMBEDDING_MODEL = get_model(
|
||||||
)
|
DEFAULT_MODELS.default_embedding_model, model_type="embedding"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
EMBEDDING_MODEL = None
|
||||||
|
|
||||||
SPEECH_TO_TEXT_MODEL = get_model(
|
if DEFAULT_MODELS.default_speech_to_text_model:
|
||||||
DEFAULT_MODELS.default_speech_to_text_model, model_type="speech_to_text"
|
SPEECH_TO_TEXT_MODEL = get_model(
|
||||||
)
|
DEFAULT_MODELS.default_speech_to_text_model, model_type="speech_to_text"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
SPEECH_TO_TEXT_MODEL = None
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
from typing import ClassVar, Optional
|
from typing import ClassVar, Optional
|
||||||
|
|
||||||
from loguru import logger
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from open_notebook.database.repository import (
|
from open_notebook.database.repository import (
|
||||||
|
|
@ -37,8 +36,10 @@ class DefaultModels(BaseModel):
|
||||||
def load(self):
|
def load(self):
|
||||||
result = repo_query("SELECT * FROM open_notebook:default_models;")
|
result = repo_query("SELECT * FROM open_notebook:default_models;")
|
||||||
if result:
|
if result:
|
||||||
logger.debug(result)
|
result = result[0]
|
||||||
return DefaultModels(**result[0])
|
dm = DefaultModels(**result)
|
||||||
|
return dm
|
||||||
|
return DefaultModels()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def update(self, data):
|
def update(self, data):
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,6 @@ with model_tab:
|
||||||
st.caption(
|
st.caption(
|
||||||
f"Unavailable Providers: {', '.join(unavailable_providers)}. Please check docs page if you wish to enable them."
|
f"Unavailable Providers: {', '.join(unavailable_providers)}. Please check docs page if you wish to enable them."
|
||||||
)
|
)
|
||||||
model_name = st.text_input("Model Name", "")
|
|
||||||
|
|
||||||
# Filter model types based on provider availability in MODEL_CLASS_MAP
|
# Filter model types based on provider availability in MODEL_CLASS_MAP
|
||||||
available_model_types = []
|
available_model_types = []
|
||||||
|
|
@ -76,7 +75,14 @@ with model_tab:
|
||||||
if not available_model_types:
|
if not available_model_types:
|
||||||
st.error(f"No compatible model types available for provider: {provider}")
|
st.error(f"No compatible model types available for provider: {provider}")
|
||||||
else:
|
else:
|
||||||
model_type = st.selectbox("Model Type", available_model_types)
|
model_type = st.selectbox(
|
||||||
|
"Model Type",
|
||||||
|
available_model_types,
|
||||||
|
help="Use language for text generation models, text_to_speech for TTS models for generating podcasts, etc.",
|
||||||
|
)
|
||||||
|
model_name = st.text_input(
|
||||||
|
"Model Name", "", help="gpt-4o-mini, claude, gemini, llama3, etc"
|
||||||
|
)
|
||||||
if st.button("Save"):
|
if st.button("Save"):
|
||||||
model = Model(name=model_name, provider=provider, type=model_type)
|
model = Model(name=model_name, provider=provider, type=model_type)
|
||||||
model.save()
|
model.save()
|
||||||
|
|
@ -209,9 +215,8 @@ with model_defaults_tab:
|
||||||
"Caution: you cannot change the embedding model once there is embeddings or they will need to be regenerated"
|
"Caution: you cannot change the embedding model once there is embeddings or they will need to be regenerated"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# if st.button("Save Defaults", key="save_defaults"):
|
||||||
for k, v in defs.items():
|
for k, v in defs.items():
|
||||||
defs[k] = v.id
|
if v:
|
||||||
|
defs[k] = v.id
|
||||||
if st.button("Save Defaults", key="save_defaults"):
|
DefaultModels.update(defs)
|
||||||
DefaultModels.update(defs)
|
|
||||||
st.rerun()
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "open-notebook"
|
name = "open-notebook"
|
||||||
version = "0.0.6"
|
version = "0.0.7"
|
||||||
description = "An open source implementation of a research assistant, inspired by Google Notebook LM"
|
description = "An open source implementation of a research assistant, inspired by Google Notebook LM"
|
||||||
authors = ["Luis Novo <lfnovo@gmail.com>"]
|
authors = ["Luis Novo <lfnovo@gmail.com>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue