![]() |
ThalamOS
a powerful Flask web application designed to enhance your storage management.
|
Classes | |
class | SQLQuery |
Functions | |
setup_ollama () | |
pre_check_ollama_enabled () | |
check_ollama_enabled (func) | |
get_ollama_models () | |
pd.DataFrame | storage_table_to_csv (str path) |
ask_question (msg) | |
Variables | |
Annotated | ENV_PATH |
dotenv_path | |
tuple | is_ollama_enabled |
Annotated | ollama_host |
Annotated | default_model |
Annotated | DATABASE_PATH |
prompt_instance | |
fallback_prompt_instance | |
global_Pipeline = setup_ollama() | |
This module manages interactions with the Ollama model and the SQLite database. It includes functions to set up the Ollama pipeline, check if the Ollama feature is enabled, fetch Ollama models, convert the storage table to a CSV file, and ask questions to the Ollama model. Classes: SQLQuery: A class to execute SQL queries on the SQLite database. Functions: setup_ollama: Sets up the Ollama pipeline. pre_check_ollama_enabled: Checks if the Ollama feature is enabled. check_ollama_enabled: A decorator to check if Ollama is enabled before executing a function. get_ollama_models: Fetches a list of Ollama models from a specified API endpoint. storage_table_to_csv: Converts the 'storage' table from the SQLite database to a CSV file. ask_question: Asks a question to the Ollama model using a haystack pipeline.
ollama_manager.ask_question | ( | msg | ) |
Asks a question to the Ollama model using a haystack pipeline. Args: msg (str): The question to ask the Ollama model. Returns: tuple: A tuple containing the type of response ("Item" or "Fallback") and the response itself.
Definition at line 253 of file ollama_manager.py.
ollama_manager.check_ollama_enabled | ( | func | ) |
Decorator to check if Ollama is enabled before executing the function. This decorator wraps a function and checks if Ollama is enabled by calling the `pre_check_ollama_enabled` function. If Ollama is enabled, the wrapped function is executed. Otherwise, a log message is generated, and the function execution is skipped. Args: func (callable): The function to be wrapped by the decorator. Returns: callable: The wrapped function that includes the Ollama enabled check.
Definition at line 191 of file ollama_manager.py.
ollama_manager.get_ollama_models | ( | ) |
Fetches a list of Ollama models from a specified API endpoint. This function sends a GET request to the API endpoint at "http://10.45.2.60:11434/api/tags", retrieves the JSON response, and extracts the list of models from the response data. Returns: list: A list of model names (strings) retrieved from the API response.
Definition at line 218 of file ollama_manager.py.
ollama_manager.pre_check_ollama_enabled | ( | ) |
Checks if the Ollama feature is enabled. Returns: bool: True if the Ollama feature is enabled, False otherwise.
Definition at line 180 of file ollama_manager.py.
ollama_manager.setup_ollama | ( | ) |
Sets up the Ollama pipeline with the necessary components and connections. This function initializes the SQLQuery component, defines routing conditions, and sets up the ConditionalRouter, OllamaGenerator, and fallback components. It then creates a Pipeline, adds the components to it, and connects them according to the defined routes. Returns: Pipeline: The configured Ollama pipeline.
Definition at line 129 of file ollama_manager.py.
pd.DataFrame ollama_manager.storage_table_to_csv | ( | str | path | ) |
Converts the 'storage' table from the SQLite database to a CSV file. Args: path (str): The file path to the SQLite database. Returns: pd.DataFrame: A DataFrame containing the data from the 'storage' table.
Definition at line 236 of file ollama_manager.py.
Annotated ollama_manager.DATABASE_PATH |
Definition at line 47 of file ollama_manager.py.
Annotated ollama_manager.default_model |
Definition at line 43 of file ollama_manager.py.
ollama_manager.dotenv_path |
Definition at line 35 of file ollama_manager.py.
Annotated ollama_manager.ENV_PATH |
Definition at line 32 of file ollama_manager.py.
ollama_manager.fallback_prompt_instance |
Definition at line 80 of file ollama_manager.py.
ollama_manager.global_Pipeline = setup_ollama() |
Definition at line 287 of file ollama_manager.py.
tuple ollama_manager.is_ollama_enabled |
Definition at line 36 of file ollama_manager.py.
Annotated ollama_manager.ollama_host |
Definition at line 40 of file ollama_manager.py.
ollama_manager.prompt_instance |
Definition at line 51 of file ollama_manager.py.