Building a Custom PC Guide using Lyzr SDK

Akshay Keerthi - Aug 5 - - Dev Community

In today’s tech-savvy world, having a custom-built PC tailored to your specific needs and budget can make all the difference. Whether you’re a gamer, a professional, or someone who simply wants a powerful machine, building a PC can be both a rewarding and cost-effective endeavor. With advancements in AI and natural language processing, tools like Lyzr Automata and OpenAI’s GPT-4 Turbo make this process even more accessible. Let’s dive into how you can build your custom PC using these powerful tools.

Why use Lyzr SDK’s?

With Lyzr SDKs, crafting your own GenAI application is a breeze, requiring only a few lines of code to get up and running swiftly.

Checkout the Lyzr SDK’s

Lets get Started!
Setting Up the Environment

First, we set up our environment using Streamlit and the Lyzr Automata SDK. Streamlit is a framework for creating interactive web applications in Python, and Lyzr Automata provides tools for leveraging AI models.

import streamlit as st
from lyzr_automata.ai_models.openai import OpenAIModel
from lyzr_automata import Agent, Task
from lyzr_automata.pipelines.linear_sync_pipeline import LinearSyncPipeline
from PIL import Image
from lyzr_automata.tasks.task_literals import InputType, OutputType
import os
Enter fullscreen mode Exit fullscreen mode

Setting the OpenAI API Key

We need to set the OpenAI API key to authenticate and access the GPT-4 Turbo model.

os.environ["OPENAI_API_KEY"] = st.secrets["apikey"]
Enter fullscreen mode Exit fullscreen mode

App Title and Introduction

We set the title and provide a brief introduction to guide users on how to use the app.

st.title("Custom PC Build Guide")
st.markdown("Welcome to the Custom PC Build Guide! Tell us your budget and what you need, and we'll help you build the perfect PC, tailored just for you.")
st.markdown("            1) Determine Your Budget.")
st.markdown("            2) Mention your needs (Primary Use,Preferred Brands if any and etc).")
st.markdown("            3) Provide additional information if any like Such as RGB lighting, quiet operation, overclocking capabilities, etc.")
input = st.text_input(" Please enter the above details:", placeholder="Type here")
Enter fullscreen mode Exit fullscreen mode

Setting Up the OpenAI Model

We initialize the OpenAI model with specific parameters for generating the PC build guide.

open_ai_text_completion_model = OpenAIModel(
    api_key=st.secrets["apikey"],
    parameters={
        "model": "gpt-4-turbo-preview",
        "temperature": 0.2,
        "max_tokens": 1500,
    },
)
Enter fullscreen mode Exit fullscreen mode

Defining the Generation Function

This function uses the Lyzr Automata SDK to create an agent that guides users through the PC building process.

def generation(input):
    generator_agent = Agent(
        role="Expert PC BUILDER and CUSTOMIZATION CONSULTANT",
        prompt_persona="Your task is to GUIDE users through the process of building their own CUSTOMIZED PC, tailored to their budget and specific needs, including primary use, preferred brands, and additional requirements such as RGB lighting, quiet operation, overclocking capabilities, etc.")
    prompt = """
[Prompts here]
"""
    generator_agent_task = Task(
        name="Generation",
        model=open_ai_text_completion_model,
        agent=generator_agent,
        instructions=prompt,
        default_input=input,
        output_type=OutputType.TEXT,
        input_type=InputType.TEXT,
    ).execute()
    return generator_agent_task
Enter fullscreen mode Exit fullscreen mode

Button to Generate the Guide

We add a button that triggers the generation of the PC build guide when clicked.

if st.button("Guide!"):
    solution = generation(input)
    st.markdown(solution)
Enter fullscreen mode Exit fullscreen mode

Building a custom PC can seem daunting at first, but with the right guidance and tools, it becomes a manageable and even enjoyable task. By leveraging the capabilities of Lyzr Automata and OpenAI’s GPT-4 Turbo, you can receive expert advice tailored to your specific needs and budget. This app not only helps you choose the right components but also provides clear, step-by-step instructions to assemble your PC.

With the power of AI, you can ensure that your custom PC build meets your performance requirements, aesthetic preferences, and budget constraints. Whether you’re a gamer, a professional, or simply a tech enthusiast, this guide aims to simplify the process and make your custom PC building experience as smooth as possible.

App link: https://custompc-lyzr.streamlit.app/

Source Code: https://github.com/isakshay007/Custom_PC

The Custom PC Guide is powered by the Lyzr Automata Agent, utilizing the capabilities of OpenAI’s GPT-4 Turbo. For any inquiries or issues, please contact Lyzr. You can learn more about Lyzr and their offerings through the following links:

Website: Lyzr.ai
Book a Demo: Book a Demo
Discord: Join our Discord community
Slack: Join our Slack channel

Feel free to explore the app, provide your details, and start building the PC of your dreams. Happy building!

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player