import streamlit as st import openai # Assuming your OpenAI API key is set in an environment variable or entered in the app # For the app, we'll ask the user to input it directly for demonstration purposes def generate_detailed_artifact(api_key, description, artifact_type): """ Generate a detailed and sophisticated artifact for software development projects. """ sophisticated_prompts = { "Strategic Alignment Report": "Craft a comprehensive report that articulates the alignment of AI initiatives with the organization's long-term strategic goals, demonstrating how AI can be leveraged for strategic advantage.", "Enhanced Process Maps": "Develop enhanced process maps indicating AI integration points. Detail the current versus future state of processes, specifying where AI brings value.", "AI Impact Forecast": "Generate a forecast report that assesses the potential impacts of AI on business processes, scalability of solutions, and a framework for measuring and monitoring these impacts.", "Stakeholder Engagement Plan": "Create a detailed stakeholder engagement plan that lists all stakeholders, their concerns, expectations, and strategies for managing the cultural shift towards AI adoption.", "AI Risk Mitigation Strategy": "Construct a comprehensive risk mitigation strategy document outlining the potential risks of AI integration and detailed plans for addressing these risks.", "Cost-Benefit Analysis Document": "Produce a cost-benefit analysis document for AI projects, detailing investment requirements, financial benefits, total cost of ownership, and prioritization of initiatives based on financial metrics.", "AI Prototyping Strategy": "Outline a strategic plan for prototyping AI initiatives, including the prototyping phases, success metrics, resource needs, and a feedback incorporation mechanism.", "Change Management Framework": "Develop a change management framework that analyzes the impact of AI, provides a detailed change plan, identifies training needs, and establishes clear communication strategies.", "AI Monitoring and Review Framework": "Design a continuous AI monitoring and evaluation framework that details the KPIs, integration with BI systems, and the periodic review process for AI initiatives.", "AI Roadmap and Action Plan": "Synthesize a strategic AI roadmap and action plan document based on workshop findings, assigning responsibilities and deadlines for the completion of action items." } prompt = sophisticated_prompts.get(artifact_type, "Generate a detailed document section:") + "\n" + description try: openai.api_key = api_key response = openai.Completion.create( model="gpt-4", # Adjust model as necessary prompt=prompt, temperature=0.5, max_tokens=1024, top_p=1.0, frequency_penalty=0.0, presence_penalty=0.0 ) return response.choices[0].text.strip() except Exception as e: return f"An error occurred: {str(e)}" st.title("AI-Enabled Project Artifact Generator") api_key = st.text_input("Enter your OpenAI API key", type="password") artifact_type = st.selectbox("Select Artifact Type", list(sophisticated_prompts.keys())) description = st.text_area("Project Description", "Enter your project description here.") if st.button("Generate Artifact"): if api_key and description and artifact_type: generated_artifact = generate_detailed_artifact(api_key, description, artifact_type) st.markdown("## Generated Artifact") st.write(generated_artifact) else: st.error("Please fill out all fields.")