import os from dotenv import load_dotenv import streamlit as st import google.generativeai as genai from langchain_google_genai import ChatGoogleGenerativeAI from crewai import Crew, Task, Agent # Loading Google Gemini API Key from Environment Variables load_dotenv() genai.configure(api_key=os.getenv("GOOGLE_API_KEY")) lv_model = ChatGoogleGenerativeAI(model="gemini-pro", temperature=0.0, top_p=0.85 ) # Main Program def main(): try: # -- Streamlit Settings st.set_page_config("Product Manager and Tester") st.header("Product Manager and Tester 💁") st.text("") st.text("") st.text("") # -- Crew AI -> Defining roles lv_product_manager_agent = Agent( role = "Product Manager", goal = "To create a detailed requirement document for provided business use cases.", backstory = "A professional Product Manager with a wealth of experience in creating requirement documents for customer-facing business applications using Oracle Jet and Spring Boot.", verbose= True, allow_delegation=False, llm=lv_model ) lv_tester_agent = Agent( role = "Tester", goal = "The Tester's primary goal is to develop executable test cases tailored to the provided business use cases. These test cases should focus on validating functionality within the Oracle Jet and Spring Boot technical stack.", backstory = "The agent is an experienced Tester proficient in Oracle Jet and Spring Boot technologies, with a deep understanding of business use cases.", verbose= True, allow_delegation=True, llm=lv_model ) # -- Crew AI -> Add Tasks lv_business_usecase_prompt = st.text_area("Enter Business Usecase?") lv_product_manager_task = Task( description=f''' 0. {lv_business_usecase_prompt} 1. A detailed requirement document outlining the functional and non-functional requirements, user stories, use cases, and any other pertinent information necessary for the development team. 2. The requirement document should specifically address how Oracle Jet and Spring Boot technologies will be utilized to fulfill the identified requirements. 3. The Product Manager has been briefed on the project scope and requirements. They are expected to collaborate with relevant stakeholders to gather additional insights and ensure the accuracy and completeness of the requirement document. 4. Regular updates on the progress of the task are expected to be provided to the project manager or relevant team members. ''', expected_output=''' 1. Comprehensive requirement document covering all aspects of the project, including user stories, functional and non-functional requirements, and technical specifications. 2. Clear alignment between the requirement document and the provided business use cases, ensuring a solid foundation for the development process. 3. Output should be having sections 1. Overview, 2. Enahcement Details ''', agent=lv_product_manager_agent ) lv_tester_task = Task( description=''' 1. Executable test cases covering all relevant scenarios and functionalities specified in the business use cases. 2. The test cases should be well-documented, providing clear instructions for execution and verification. 3. Comprehensive test reports detailing the results of the testing process, including any defects or anomalies discovered. 4. The Tester should collaborate closely with the development team and other stakeholders to understand the requirements and design effective test scenarios. 5. Regular communication and feedback loops will be established to ensure the alignment of testing efforts with project objectives. 6. The Tester is encouraged to leverage automated testing tools and frameworks to streamline the testing process and improve efficiency. ''', expected_output=''' 1. Set of executable test cases covering all identified scenarios and functionalities, demonstrating thorough testing coverage. 2. Test documentation providing clear instructions for executing and validating the test cases, facilitating easy replication and verification. 3. Detailed test reports highlighting the results of the testing process, including any identified defects or issues. 4. Add negative and postivie test cases 5. Output should be a table with headers Sno, Description, Expectation ''', agent=lv_tester_agent ) # -- Crew AI -> Create Crew lv_tester_crew = Crew( agents=[lv_product_manager_agent, lv_tester_agent], tasks=[lv_product_manager_task, lv_tester_task], verbose=True ) # -- Crew AI -> Generate Response if st.button("Generate"): with st.spinner("Generating response..."): with st.expander("Tester"): st.write(lv_tester_crew.kickoff()) with st.expander("Product Manager"): st.write(lv_product_manager_task.output.exported_output) except Exception as e: st.write("Click on Generate Button Again") # Loading Main if __name__ == "__main__": main()