From 571431d9ee0ab760fe802c12f0721f7d2a4fdea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Augustyniak?= Date: Tue, 9 Apr 2024 14:14:55 +0200 Subject: [PATCH] docker compsoe and streamlit updates --- .gitignore | 1 + ...37\224\215_Extract_Information_from_Judgements.py" | 2 +- docker-compose.yml | 9 +++------ juddges/prompts/information_extraction.py | 11 +++++++---- juddges/settings.py | 4 +--- requirements.txt | 1 + 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index d73b47c..f3eccc9 100644 --- a/.gitignore +++ b/.gitignore @@ -152,3 +152,4 @@ checklink/cookies.txt .history secrets.env +postgres-juddges/** diff --git "a/dashboards/pages/00_\360\237\224\215_Extract_Information_from_Judgements.py" "b/dashboards/pages/00_\360\237\224\215_Extract_Information_from_Judgements.py" index 436a242..f37eb26 100644 --- "a/dashboards/pages/00_\360\237\224\215_Extract_Information_from_Judgements.py" +++ "b/dashboards/pages/00_\360\237\224\215_Extract_Information_from_Judgements.py" @@ -45,7 +45,7 @@ ["gpt-3.5-turbo-1106", "gpt-4-0125-preview", "gpt-4-1106-preview"], ) -if st.button("Ask for schema"): +if st.button("Generate schema to extract information"): chain = prepare_schema_chain(model_name=llm_schema) schema = chain.invoke({"SCHEMA_TEXT": schema_query}) if not schema: diff --git a/docker-compose.yml b/docker-compose.yml index 497ad6a..44cbd59 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,18 +4,15 @@ name: juddges services: web: build: . - command: streamlit run /app/dashboards/app.py + command: streamlit run /app/dashboards/⚖️_Project_Information.py volumes: - ./:/app - ~/.cache:/root/.cache - L:\docker-configs\zsh\smartass_zsh_history:/root/.zsh_history tty: true shm_size: "2gb" - environment: - - OPENAI_API_KEY=${OPENAI_API_KEY} - - MLFLOW_TRACKING_URI=${MLFLOW_TRACKING_URI} - - MLFLOW_S3_ENDPOINT_URL=${MLFLOW_S3_ENDPOINT_URL} - - LOGNAME=${LOGNAME} + env_file: + - .env restart: always deploy: resources: diff --git a/juddges/prompts/information_extraction.py b/juddges/prompts/information_extraction.py index 5c36551..edf7474 100644 --- a/juddges/prompts/information_extraction.py +++ b/juddges/prompts/information_extraction.py @@ -41,15 +41,18 @@ """ EXAMPLE_SCHEMA = """ -date: date -verdict: string +verdict_date: date as ISO 8601 +verdict: string, text representing verdict of the judgement +verdict_summary: string, short summary of the verdict +verdict_id: string court: string -appellant: string +parties: string appeal_against: string first_trial: boolean drug_offence: boolean -single_transaction_multiple_offence: boolean +child_offence: boolean offence_seriousness: boolean +verdict_tags: List[string] """ diff --git a/juddges/settings.py b/juddges/settings.py index 4713f59..292457c 100644 --- a/juddges/settings.py +++ b/juddges/settings.py @@ -61,8 +61,6 @@ def prepare_langchain_cache() -> None: langchain.llm_cache = SQLAlchemyMd5Cache(get_sqlalchemy_engine()) -def prepare_mlflow( - experiment_name: str = MLFLOW_EXP_NAME, url="http://host.docker.internal" -) -> None: +def prepare_mlflow(experiment_name: str = MLFLOW_EXP_NAME, url="postgres-juddges") -> None: mlflow.set_tracking_uri(url) mlflow.set_experiment(experiment_name) diff --git a/requirements.txt b/requirements.txt index f679c82..c0277ee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ datasets==2.18.0 langchain-openai==0.1.1 langchain==0.1.13 +langsmith==0.1.33 loguru==0.7.2 mpire==2.10.0 pandas==2.2.1