Skip to content

Chore/code modernization - #21

Merged
pierrepo merged 61 commits into
mainfrom
chore/code-modernization
Feb 11, 2026
Merged

Chore/code modernization#21
pierrepo merged 61 commits into
mainfrom
chore/code-modernization

Conversation

@Essmaw

@Essmaw Essmaw commented Jan 26, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@Essmaw
Essmaw marked this pull request as draft January 26, 2026 17:47
Essmaw and others added 23 commits January 27, 2026 12:24
… a little bit logging in chatbot application.
@Essmaw

Essmaw commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @Essmaw

I managed to create the vector database, but I encountered an error while running the command:

$ uv run python src/query_chatbot.py --query "What is the difference between list and set ?" \
                  --level "intermediaire" \
                  --model gpt-4o \
                  --prompt_path "prompts/zero_shot.txt" \
                  --include-metadata
2026-02-11 14:46:36 | INFO     | Starting the command line interface for querying the chatbot...
2026-02-11 14:46:36 | INFO     | Loading the vector database...
2026-02-11 14:46:36 | INFO     | Chunks in the database: 1317
2026-02-11 14:46:36 | SUCCESS  | Vector database prepared successfully.
2026-02-11 14:46:36 | INFO     | Getting the list of chapter IDs relevant to the user level...
2026-02-11 14:46:36 | SUCCESS  | Chapter IDs for level 'intermediaire': ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', 'B']
2026-02-11 14:46:36 | INFO     | Searching for relevant documents in the database...
2026-02-11 14:46:37 | SUCCESS  | Retrieval completed with 3 relevant chunks found.
/home/pierre/workp/teaching/AO/2023_AAP_Idex_innov_péda_LLM-UPCité/2024_stage_M1_Essmay_Touami/Essmay_Touami/biopyassistant.git/.venv/lib/python3.13/site-packages/click/core.py:824: UserWarning: WARNING! ai_api_key is not default parameter.
                ai_api_key was transferred to model_kwargs.
                Please confirm that ai_api_key is what you intended.

[...]
  File "/home/pierre/workp/teaching/AO/2023_AAP_Idex_innov_péda_LLM-UPCité/2024_stage_M1_Essmay_Touami/Essmay_Touami/biopyassistant.git/.venv/lib/python3.13/site-packages/openai/_utils/_utils.py", line 286, in wrapper
    return func(*args, **kwargs)
TypeError: Completions.create() got an unexpected keyword argument 'ai_api_key'

Thanks @pierrepo! Fixed this — it was a wrong ChatOpenAI initialization.
And to get a response from the chatbot, the question must be asked in French. Example command:

uv run python src/query_chatbot.py --query "C'est quoi la différence entre une liste et un set ?" \
    --level "avance" \
    --model gpt-4o \
    --prompt_path "prompts/zero_shot.txt" \
    --include-metadata

Comment thread prompt_templates/common.txt

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 20 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/create_database.py Outdated
Comment thread src/query_chatbot.py
Comment thread src/query_chatbot.py
Comment thread src/parse_clean_markdown.py
Comment thread src/parse_clean_markdown.py
Comment thread src/parse_clean_markdown.py
@Essmaw
Essmaw requested a review from pierrepo February 11, 2026 20:53
@pierrepo

Copy link
Copy Markdown
Owner

For some reason I don't understand, the streamlit app cannot run.

Here is the error message I got:


File "/home/pierre/workp/teaching/AO/2023_AAP_Idex_innov_péda_LLM-UPCité/2024_stage_M1_Essmay_Touami/Essmay_Touami/biopyassistant.git/src/streamlit_app.py", line 26, in <module>
    from query_chatbot import load_database, search_similarity_in_database, get_metadata, format_chat_history, contextualize_question,  generate_answer, add_metadata_to_answer, MSGS_QUERY_NOT_RELATED, OPENAI_MODEL_NAME, CHROMA_PATH

Comment thread prompt_templates/common.txt Outdated
Comment thread prompt_templates/common.txt Outdated
Comment thread src/create_database.py Outdated
@Essmaw

Essmaw commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator Author

For some reason I don't understand, the streamlit app cannot run.

Here is the error message I got:


File "/home/pierre/workp/teaching/AO/2023_AAP_Idex_innov_péda_LLM-UPCité/2024_stage_M1_Essmay_Touami/Essmay_Touami/biopyassistant.git/src/streamlit_app.py", line 26, in <module>
    from query_chatbot import load_database, search_similarity_in_database, get_metadata, format_chat_history, contextualize_question,  generate_answer, add_metadata_to_answer, MSGS_QUERY_NOT_RELATED, OPENAI_MODEL_NAME, CHROMA_PATH

The error is expected because this is the old script that was working before the changes in this PR. I’ve created a separate PR for the new Streamlit interface (#24), but I’m waiting to merge this PR first so everything fits together correctly!

Comment thread src/create_database.py Outdated
@Essmaw
Essmaw requested a review from pierrepo February 11, 2026 21:30
@pierrepo

Copy link
Copy Markdown
Owner

Good for me. Thanks @Essmaw

@pierrepo
pierrepo merged commit e48a6d5 into main Feb 11, 2026
@pierrepo
pierrepo deleted the chore/code-modernization branch February 11, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants