Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Llamaindex commit #11

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Initial Llamaindex commit #11

wants to merge 8 commits into from

Conversation

AIMikav
Copy link
Collaborator

@AIMikav AIMikav commented Jan 31, 2025

This PR introduces the initial implementation of a multi-agent framework using LlamaIndex with the following updates:

  1. FastAPI Backend: RESTful API for insurance score generation and approval using LLM.
  2. Streamlit Frontend: Simple UI for user interaction with the agent.
  3. Environment Variable Support: Configurable LLM model via LLAMA_MODEL_NAME.
  4. README Update: Instructions for setting up FastAPI, Streamlit, environment variables, and added image documentation.

Copy link
Member

Choose a reason for hiding this comment

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

Its a good practice to not actually include the .env file in your repo as it can leak credentials. I recommend adding a .env.example with dummy values for the parameters, and adding a .gitignore that includes .env so it doesn't get tracked by git.

Copy link
Member

@tumido tumido left a comment

Choose a reason for hiding this comment

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

Just a code quality/code smell nit. 🙂 It is good to keep your code clean so it's easier to maintain. It reduces possibility of bugs, allows others to orient themselves in the codebase much faster etc and in the end leads to fewer errors...

Comment on lines 13 to 26
if st.button("Submit"):
if user_input:
# Call FastAPI backend with the user input
url = "http://127.0.0.1:8000/process_input/"
response = requests.post(url, json={"text": user_input})

if response.status_code == 200:
result = response.json()
st.write(f"Generated Insurance Score: {result['response']}")
st.write(f"Approval Status: {result['approval_status']}")
else:
st.write("There was an error processing the request.")
else:
st.write("Please enter some information about your driving history.")
Copy link
Member

Choose a reason for hiding this comment

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

Just a nit for code quality. The Zen of Python says: Flat is better than nested.

Suggested change
if st.button("Submit"):
if user_input:
# Call FastAPI backend with the user input
url = "http://127.0.0.1:8000/process_input/"
response = requests.post(url, json={"text": user_input})
if response.status_code == 200:
result = response.json()
st.write(f"Generated Insurance Score: {result['response']}")
st.write(f"Approval Status: {result['approval_status']}")
else:
st.write("There was an error processing the request.")
else:
st.write("Please enter some information about your driving history.")
if not st.button("Submit"):
return
if not user_input:
st.write("Please enter some information about your driving history.")
return
...
if response.status_code != 200:
st.write("There was an error processing the request.")
return
...

@AIMikav
Copy link
Collaborator Author

AIMikav commented Feb 4, 2025

Deleted .env file and included .gitignore and .env.example, Also changed the streamlit_ui.py script with less nesting.

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