diff --git a/Makefile b/Makefile index 0f0ce2f..f9f6152 100644 --- a/Makefile +++ b/Makefile @@ -51,3 +51,7 @@ docker-update-latest: docker-buildx-prepare # Release with latest docker-release-all: docker-release docker-update-latest + + +dev: + docker compose -f docker-compose.dev.yml up --build \ No newline at end of file diff --git a/README.md b/README.md index 9f9c745..564fbe0 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ services: open_notebook: image: lfnovo/open_notebook:latest ports: - - "8502:8502" + - "8080:8502" env_file: - ./docker.env 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. -- **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. -- **Recursive Summarization**: Tackle large content by recursively summarizing it. - **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. -- **Podcast Generator**: Automatically convert your notes into a podcast format. -- **Multi-model support**: Open AI, Anthropic, Gemini, Vertex AI, Open Router, Ollama. ## 🚀 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 🎙️ You can now build amazing custom podcasts based on your own data. Customize your speakers, episode structure, cadence, voices, etc. diff --git a/app_home.py b/app_home.py index 43890e3..9840c6c 100644 --- a/app_home.py +++ b/app_home.py @@ -1,9 +1,13 @@ import streamlit as st -from open_notebook.config import DEFAULT_MODELS 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 +default_models = DefaultModels.load() + version_sidebar() mm = MigrationManager() if mm.needs_migration: @@ -13,27 +17,25 @@ if mm.needs_migration: st.success("Migration successful") st.rerun() elif ( - not DEFAULT_MODELS.default_chat_model - or not DEFAULT_MODELS.default_transformation_model + not default_models.default_chat_model + or not default_models.default_transformation_model ): st.warning( "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( "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( "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( "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( "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." ) diff --git a/docs/SETUP.md b/docs/SETUP.md index 52753da..9a60be2 100644 --- a/docs/SETUP.md +++ b/docs/SETUP.md @@ -104,7 +104,7 @@ or the shourcut make run ``` -## Setting up the providers +## Setting up the providers and models 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. -### 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 -- anthropic/claude-3-5-sonnet-20240620 -- ollama/gemma2 -- openrouter/nvidia/llama-3.1-nemotron-70b-instruct -- vertexai/gemini-1.5-flash-001 -- gemini/gemini-1.5-flash-001 +| Model Type | Supported Providers | +|------------|-----------| +| Language | OpenAI, Anthropic, Open Router, LiteLLM, Vertex AI, Vertex AI, Anthropic, Gemini, Ollama | +| Embedding | OpenAI, Gemini, Vertex AI, Ollama | +| Speech to Text | OpenAI | +| 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 -- **SUMMARIZATION_MODEL (optional)** is used on the content summarization +| Model Default | Purpose | +|------------|-----------| +| 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. diff --git a/open_notebook/config.py b/open_notebook/config.py index 7a45dc9..8c0bdcd 100644 --- a/open_notebook/config.py +++ b/open_notebook/config.py @@ -38,10 +38,16 @@ os.makedirs(PODCASTS_FOLDER, exist_ok=True) DEFAULT_MODELS = DefaultModels.load() -EMBEDDING_MODEL = get_model( - DEFAULT_MODELS.default_embedding_model, model_type="embedding" -) +if DEFAULT_MODELS.default_embedding_model: + EMBEDDING_MODEL = get_model( + DEFAULT_MODELS.default_embedding_model, model_type="embedding" + ) +else: + EMBEDDING_MODEL = None -SPEECH_TO_TEXT_MODEL = get_model( - DEFAULT_MODELS.default_speech_to_text_model, model_type="speech_to_text" -) +if DEFAULT_MODELS.default_speech_to_text_model: + SPEECH_TO_TEXT_MODEL = get_model( + DEFAULT_MODELS.default_speech_to_text_model, model_type="speech_to_text" + ) +else: + SPEECH_TO_TEXT_MODEL = None diff --git a/open_notebook/domain/models.py b/open_notebook/domain/models.py index aea8551..5699147 100644 --- a/open_notebook/domain/models.py +++ b/open_notebook/domain/models.py @@ -1,6 +1,5 @@ from typing import ClassVar, Optional -from loguru import logger from pydantic import BaseModel from open_notebook.database.repository import ( @@ -37,8 +36,10 @@ class DefaultModels(BaseModel): def load(self): result = repo_query("SELECT * FROM open_notebook:default_models;") if result: - logger.debug(result) - return DefaultModels(**result[0]) + result = result[0] + dm = DefaultModels(**result) + return dm + return DefaultModels() @classmethod def update(self, data): diff --git a/pages/9_⚙️_Settings.py b/pages/9_⚙️_Settings.py index 02ca7e7..a7b515d 100644 --- a/pages/9_⚙️_Settings.py +++ b/pages/9_⚙️_Settings.py @@ -65,7 +65,6 @@ with model_tab: st.caption( 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 available_model_types = [] @@ -76,7 +75,14 @@ with model_tab: if not available_model_types: st.error(f"No compatible model types available for provider: {provider}") 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"): model = Model(name=model_name, provider=provider, type=model_type) 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" ) + # if st.button("Save Defaults", key="save_defaults"): for k, v in defs.items(): - defs[k] = v.id - - if st.button("Save Defaults", key="save_defaults"): - DefaultModels.update(defs) - st.rerun() + if v: + defs[k] = v.id + DefaultModels.update(defs) diff --git a/pyproject.toml b/pyproject.toml index c8d5138..50584a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] 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" authors = ["Luis Novo "] license = "MIT"