Build an AI Search Assistant with GPT-4o in just 15 lines of Python Code (step-by-step instructions):
1. Install the necessary Python Libraries
Run the following command from your terminal.
2. Import necessary libraries
• Streamlit for building the web app
• Phidata for building AI agents
• OpenAI for using the LLM
• Duckduckgo for the search functionality
3. Set up the Streamlit App
Streamlit lets you create user interface with just python code, for this app we will:
• Add a title to the app using 'st.title()'
• Add a description for the app using 'st.caption()'
4. Create and Initialize the AI assistant
• Create a text input to enter their OpenAI API key using 'st.text_input()'
• If the OpenAI API key is provided, create an instance of Assistant with gpt-4 as LLM and DuckDuckGo as the tool.
5. Search the Web with your Generative AI assistant
• Create a text input for the user to enter their query using 'st.text_input()'
• If a question is asked, run the assistant to get the answer and display it using 'st.write()'
Full Application code for Generative AI Search Assistant👇
Working Application demo using Streamlit
Paste the above code in vscode or pycharm and run the following command: 'streamlit run ai_webagent.py'
Find all the awesome LLM Apps demo with RAG and AI agents in the following Github Repo.
JSON prompting is a way of asking an LLM using a clear, structured format (with keys and values) and expecting the response in the same structured style.
Text prompts → inconsistent, messy outputs
JSON prompt → consistent, parseable data
The Problem With Text Prompts
Natural language is strong, but in AI it’s loose.
“Summarize this email” or “give key takeaways” leaves room for guesswork.
You wouldn’t tell a junior: “Make it better. Do what feels right.”
Stop building AI agents that ignore your instructions.
This Python framework guarantees LLM Agents follow your rules in production. Every single time.
100% Opensource.
Traditional approach: Write 47-rule system prompts and pray the LLM follows them.
Parlant (@EmcieCo) approach: Define clear guidelines that are contextually matched and enforced.
No more "roll of the dice" conversations.
Parlant Version 3 just dropped:
• Guidelines: Rules you set are enforced every single time
• Journeys: Conversations adapt when users go off-script
• Playground: Watch, test, and debug in full context
• Widget: Production-ready chat UI you can drop anywhere