<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ #PromptEngineering - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ #PromptEngineering - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Tue, 26 May 2026 04:44:02 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/promptengineering/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to Write Effective Prompts for AI Agents using Langbase ]]>
                </title>
                <description>
                    <![CDATA[ Prompt engineering isn’t just a skill these days – it gives you an important competitive edge in your development. In 2025, the difference between AI agents that work and those that don’t comes down to how well they’re prompted. Whether you’re a deve... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-write-effective-prompts-for-ai-agents-using-langbase/</link>
                <guid isPermaLink="false">67dae1dae49263fce2ef7dc3</guid>
                
                    <category>
                        <![CDATA[ llm ]]>
                    </category>
                
                    <category>
                        <![CDATA[ AI ]]>
                    </category>
                
                    <category>
                        <![CDATA[ ai agents ]]>
                    </category>
                
                    <category>
                        <![CDATA[ #PromptEngineering ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Maham Codes ]]>
                </dc:creator>
                <pubDate>Wed, 19 Mar 2025 15:25:14 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1742397395773/51f66f8f-56a4-418e-a59e-141de64be2b2.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Prompt engineering isn’t just a skill these days – it gives you an important competitive edge in your development.</p>
<p>In 2025, the difference between AI agents that work and those that don’t comes down to how well they’re prompted. Whether you’re a developer, product manager, or just building with AI, getting really good at prompt engineering will make you significantly more effective.</p>
<p>Langbase lets you craft high-performance prompts and deploy serverless AI agents optimized for the latest models. In this article, we’ll break down tips and tricks to help you design effective prompts. We’ll also look at some advanced prompt engineering techniques for building serverless agents, and how to fine-tune LLM parameters to get the best results.</p>
<h3 id="heading-prerequisites">Prerequisites</h3>
<p>To get the most out of this article, you’ll need:</p>
<ul>
<li><p>A Langbase account – <a target="_blank" href="http://langbase.com/signup">Sign up</a> if you haven’t already.</p>
</li>
<li><p>Basic knowledge of <a target="_blank" href="https://www.freecodecamp.org/news/how-to-start-building-projects-with-llms/">LLMs</a>, <a target="_blank" href="https://www.freecodecamp.org/news/how-ai-agents-can-supercharge-language-models-handbook/">AI agents</a>, and <a target="_blank" href="https://www.freecodecamp.org/news/learn-rag-fundamentals-and-advanced-techniques/">RAG (retrieval-augmented generation)</a>.</p>
</li>
</ul>
<h3 id="heading-heres-what-ill-cover"><strong>Here’s what I’ll cover:</strong></h3>
<ul>
<li><p><a class="post-section-overview" href="#heading-prompt-engineering-fundamentals">Prompt engineering fundamentals</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-tips-and-tricks-for-effective-prompt-design">Tips and tricks for effective prompt design</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-langbase-pipe-agent-prompts">Langbase pipe agent prompts</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-prompt-engineer-your-ai-agent">How to prompt engineer your AI agent</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-fine-tune-llm-models-response-parameters">Fine-tune LLM model’s response parameters</a></p>
</li>
</ul>
<p>Let’s get started!</p>
<h2 id="heading-prompt-engineering-fundamentals">Prompt Engineering Fundamentals</h2>
<p>A prompt tells the AI what to do—it sets the context, guides the response, and shapes the conversation. Prompt engineering is about designing prompts that make AI agents actually useful in real-world applications.</p>
<p>Here’s how to write good prompts:</p>
<h3 id="heading-1-define-your-goal-clearly">1. Define your goal clearly</h3>
<p>Before crafting a prompt, be clear about what you want to achieve—just like planning logic before writing code. Consider whether dynamic inputs are needed and how they’ll be handled. Define the ideal output format, whether JSON, XML, or plain text. Determine if the model requires additional context or if its training data is enough.</p>
<p>Set any constraints on response length, structure, or tone. Fine-tune LLM parameters if necessary to improve control. The more precise your goals, the better the results. And remember, effective prompt engineering is often a team effort.</p>
<p>Here’s an example prompt to help you out. If you're building a customer support bot, your goal should look like this:</p>
<p><em>"Generate concise, polite responses in plain text, pulling details from the company knowledge base."</em></p>
<ul>
<li><p>Define the output format (JSON, XML, plain text).</p>
<ul>
<li><em>Example: "Respond in JSON format with 'answer' and 'source' fields."</em></li>
</ul>
</li>
<li><p>Decide if extra context is needed.</p>
<ul>
<li><em>Example: "Use this document as reference: [URL]."</em></li>
</ul>
</li>
<li><p>Set constraints on length, tone, or structure.</p>
<ul>
<li><em>Example: "Limit response to 50 words, use a friendly tone."</em></li>
</ul>
</li>
</ul>
<h3 id="heading-2-experiment-relentlessly">2. Experiment relentlessly</h3>
<p>LLMs aren’t perfect, and neither is prompt engineering. Test everything. Try different formats, tweak parameters, and provide examples. AI models vary in capability—refining prompts through iteration is the only way to ensure reliable outputs.</p>
<p>Suppose your AI isn’t giving useful answers. You could:</p>
<ul>
<li><p><strong>Rephrase the prompt</strong>: Instead of <em>"Explain this topic,"</em> try <em>"Summarize this in one paragraph with key takeaways."</em></p>
</li>
<li><p><strong>Add constraints</strong>: <em>"Limit response to three bullet points."</em></p>
</li>
<li><p><strong>Give examples</strong>: <em>"For example, if asked about Python, reply like this: 'Python is a versatile language used for AI, web development, and automation.'”</em></p>
</li>
</ul>
<h3 id="heading-3-treat-llms-like-machines-not-humans">3. Treat LLMs like machines, not humans</h3>
<p>LLMs don’t think. They follow instructions—precisely. Ambiguity confuses them. Over-explaining can be just as bad as under-explaining. And remember: LLMs will generate an answer, even if it’s wrong. You have to manage this risk.</p>
<p>Here’s a comparison between over and under-explaining prompts:</p>
<p><strong>Over-explaining:</strong> <em>"Can you please, if possible, provide a very detailed yet concise explanation about how neural networks work, but not too technical, and try to be engaging, but also keep it short?"</em><br><strong>Better prompt:</strong> <em>"Explain neural networks in simple terms, under 100 words, with an analogy."</em></p>
<p><strong>Under-explaining:</strong> <em>"Tell me about neural networks."</em><br><strong>Better prompt:</strong> <em>"Describe neural networks in two sentences with an example."</em></p>
<h2 id="heading-tips-and-tricks-for-effective-prompt-design">Tips and Tricks for Effective Prompt Design</h2>
<p>Here are a few tips and tricks to help you effectively prompt engineer your AI and agents:</p>
<ul>
<li><p><strong>Be specific</strong> – Vague prompts lead to bad outputs. Define the format, tone, and level of detail you want. If needed, break complex tasks into smaller steps and chain your prompts.</p>
</li>
<li><p><strong>Control response length</strong> – If you need a concise response, specify the word or character limit. For example: <em>“Summarize this in 50 words.”</em></p>
</li>
<li><p><strong>Provide context</strong> – LLMs don’t know everything. If the model needs specific knowledge, include it in your prompt. For dynamic context, use a RAG-based approach to inject relevant information on demand.</p>
</li>
<li><p><strong>Use step-by-step reasoning</strong> – If a task requires logical reasoning, instruct the model explicitly: <em>“Think step by step before answering.”</em> This improves accuracy.</p>
</li>
<li><p><strong>Separate instructions from context</strong> – Long prompts can get messy. Start with clear instructions, then separate additional info.</p>
</li>
<li><p><strong>Tell it what to do, not what to avoid</strong> – Instead of saying, “Don’t explain the answer,” say, “Only output the final answer.” Positive instructions work better.</p>
</li>
<li><p><strong>Set constraints</strong> – Define limits on tone, length, or complexity. Example: <em>“Write in a professional tone, under 3 sentences.”</em></p>
</li>
<li><p><strong>Assign a role</strong> – LLMs perform better with a defined persona. Start with, “You are an expert in X,” for example, to guide the model’s behavior.</p>
</li>
<li><p><strong>Use examples</strong> – If precision matters, show the model what you expect. Techniques like few-shot and chain-of-thought (CoT) prompting help improve complex reasoning.</p>
</li>
</ul>
<h2 id="heading-langbase-pipe-agent-prompts">Langbase Pipe Agent Prompts</h2>
<p>AI agents aren’t just chatbots—they reason, plan, and take action based on user inputs. Unlike simple LLM queries, AI agents operate autonomously, making decisions and interacting with external tools to complete tasks.</p>
<p><a target="_blank" href="https://langbase.com/docs/pipe/quickstart"><strong>Langbase Pipe Agents</strong></a> are serverless AI agents with unified APIs for every LLM. They let developers define structured prompts to control agent behavior across different models. In this section, you'll learn how to structure prompts effectively by creating an AI agent Pipe to get reliable and useful responses.</p>
<h3 id="heading-the-three-key-prompts-in-langbase-pipe-agents">The three key prompts in Langbase Pipe agents</h3>
<p>To make AI agents work effectively, you need three types of prompts:</p>
<ol>
<li><p><strong>System prompt:</strong> Defines the LLM model's role, tone, and guidelines before processing user input.</p>
</li>
<li><p><strong>User prompt:</strong> The input given by the user to request a response from the model.</p>
</li>
<li><p><strong>AI assistant prompt:</strong> The model's generated response based on the user’s input.</p>
</li>
</ol>
<p>To learn how to use these three prompts with the UI using Langbase AI studio, you’ll find clear and concise instructions in this <a target="_blank" href="https://langbase.com/docs/features/prompt">guide</a>. It explains exactly where to go/what to click to write these prompts.</p>
<p>Let’s learn how to create an AI agent Pipe using the Langbase AI studio:</p>
<h3 id="heading-step-1-create-a-pipe-agent">Step 1: Create a Pipe agent</h3>
<p>After logging into your Langbase account, you can always go to <a target="_blank" href="http://pipe.new"><code>pipe.new</code></a> to create a new Pipe.</p>
<ol>
<li><p>Give your Pipe a name. Let’s call it <code>AI support agent</code>.</p>
</li>
<li><p>Click on the <code>[Create Pipe]</code> button. And just like that, you have created your first Pipe.</p>
</li>
</ol>
<p><img src="https://raw.githubusercontent.com/LangbaseInc/docs-images/refs/heads/main/guides/build-performant-rag/create-pipe-dark.jpg" alt="Creating a new Pipe" width="3456" height="1978" loading="lazy"></p>
<h3 id="heading-step-2-using-an-llm-model">Step 2: Using an LLM model</h3>
<p>If you have set up LLM API keys in your profile, the Pipe will automatically use them. If not, just hit the LLM API Keys button or head over to Settings to add Pipe-level LLM API keys.</p>
<p>Let's add an LLM provider API key now.</p>
<ol>
<li><p>Click on the LLM keys button. It will open a side panel.</p>
</li>
<li><p>Select Pipe level keys. Choose any LLM. For example, you can use <code>OpenAI</code> (for GPT) or any other 250+ <strong>supported models</strong> on Langbase.</p>
</li>
<li><p>Click on OpenAI <code>[ADD KEY]</code> button, add your LLM API key. Inside each key modal, you'll find a link <code>Get a new key from here</code> click it to create a new API key on any API provider's website.</p>
</li>
</ol>
<p><img src="https://raw.githubusercontent.com/LangbaseInc/docs-images/refs/heads/main/pipe/quickstart/updated/llm-keys-dark.jpg" alt="Add an LLM API Key" width="3456" height="1982" loading="lazy"></p>
<h3 id="heading-step-3-build-your-pipe-configure-llm-model">Step 3: Build your Pipe: Configure LLM model</h3>
<p>Let's start building our pipe. Go back to the <code>Pipe</code> tab and follow these steps:</p>
<ol>
<li><p>Click on the <code>gpt-4o-mini</code> button to select and configure the LLM model for your Pipe.</p>
</li>
<li><p>By default OpenAI <code>gpt-4o-mini</code> is selected. You can also pick any LLM model.</p>
</li>
<li><p>Choose one of the pre-configured <strong>presets</strong> for your model.</p>
</li>
<li><p>You can also modify any of the model params. Learn more with the icon, next to param name.</p>
</li>
</ol>
<p><img src="https://raw.githubusercontent.com/LangbaseInc/docs-images/refs/heads/main/pipe/quickstart/updated/model-dark.jpg" alt="Build your pipe: Configuiring the LLM model" width="3456" height="1982" loading="lazy"></p>
<h3 id="heading-step-4-build-your-pipe-configure-the-pipes-meta">Step 4: Build your Pipe: Configure the Pipe's Meta</h3>
<p>Use the Meta section to configure how your <code>AI support agent</code> Pipe should work. There are multiple ways you can configure it.</p>
<p>To start, you can set the output format of the Pipe to JSON. You can also turn on moderation mode to filter out inappropriate content as a requirement by OpenAI.</p>
<p>Then you can turn the streaming mode on and off, and turn off storing messages (input prompt and generated completion) for sensitive data like emails.</p>
<p><img src="https://raw.githubusercontent.com/LangbaseInc/docs-images/refs/heads/main/pipe/quickstart/updated/meta-dark.jpg" alt="Build your pipe: Configuiring the Pipe meta settings" width="3456" height="1982" loading="lazy"></p>
<h3 id="heading-step-5-design-a-prompt">Step 5: Design a Prompt</h3>
<p>Now that you have your LLM model and Pipe meta configured, it's time to design your prompt.</p>
<p><strong>Prompt: System Instructions</strong></p>
<p>Let's add a system instruction message to this agent. You can add this: <code>You're a helpful AI assistant. You will assist users with their queries about {{company}}. Always ensure that you provide accurate and to the point information.</code></p>
<p><img src="https://raw.githubusercontent.com/LangbaseInc/docs-images/refs/heads/main/pipe/quickstart/updated/system-prompt-dark.jpg" alt="Prompt design: System Instructions" width="3456" height="1982" loading="lazy"></p>
<p><strong>Prompt: User Message</strong></p>
<p>Now let's add a user message. Click on the <code>USER</code> button to add a new message. You can add this: <code>How to request payment API?</code>.</p>
<p><img src="https://raw.githubusercontent.com/LangbaseInc/docs-images/refs/heads/main/pipe/quickstart/updated/user-prompt-dark.jpg" alt="Prompt design: Adding a user message" width="3456" height="1982" loading="lazy"></p>
<p><strong>Prompt: Variables</strong></p>
<p>Any text written between double curly brackets <code>{{}}</code> becomes a variable. A variables section will display all your variable keys and values.</p>
<p>Since you added a variable <code>{{company}}</code>, you can see it appear in variables. Now you’re assessing the company variable value as <code>ACME</code>. This pipe will now replace <code>{{company}}</code> with its value in all messages.</p>
<p>✨ Variables allow you to use the same pipe with different data.</p>
<p><img src="https://raw.githubusercontent.com/LangbaseInc/docs-images/refs/heads/main/pipe/quickstart/updated/variables-dark.jpg" alt="Prompt design: Adding Variables" width="3456" height="1984" loading="lazy"></p>
<p><strong>Prompt as Code</strong></p>
<p>We're not writing code here, but if you were to write this prompt as code, it would look like this:</p>
<ol>
<li><p>Prompt is a <code>messages</code> array. Inside it are <code>message</code> objects.</p>
</li>
<li><p>Each <code>message</code> object typically consists of two properties:</p>
<ol>
<li><p><code>role</code> either "system", "user", or "assistant".</p>
</li>
<li><p><code>content</code> that you're sending or expecting to be generated from the AI LLM.</p>
</li>
</ol>
</li>
</ol>
<pre><code class="lang-bash">// Prompt example:
{
    messages: [
        { role: <span class="hljs-string">'system'</span>, content: <span class="hljs-string">'You are a helpful assistant.'</span> },
        { role: <span class="hljs-string">'user'</span>, content: <span class="hljs-string">'How to request payment API?'</span> },
        { role: <span class="hljs-string">'assistant'</span>, content: <span class="hljs-string">'Sure, here you go … …'</span> }
    ];
}
</code></pre>
<p>If you’re using the <strong>Langbase SDK</strong> to build serverless AI Pipe agents to define these three prompts, you need to send the prompt content in the <code>messages</code> object array as follows:</p>
<pre><code class="lang-bash">interface Message {
    role: <span class="hljs-string">'user'</span> | <span class="hljs-string">'assistant'</span> | <span class="hljs-string">'system'</span>| <span class="hljs-string">'tool'</span>;
    content: string | null;
    name?: string;
    tool_call_id?: string;
    tool_calls?: ToolCall[];
}
</code></pre>
<p>You can learn more about creating a pipe agent using the Langbase SDK <a target="_blank" href="https://langbase.com/docs/sdk/pipe/create">here.</a></p>
<p>Now that you know about creating a Pipe agent and its prompts, let's discuss a few effective techniques to prompt engineer your AI Pipe agents that’ll prove useful for a vast majority of LLMs.</p>
<h2 id="heading-how-to-prompt-engineer-your-ai-agent">How to Prompt Engineer Your AI Agent</h2>
<h3 id="heading-1-few-shot-training">1. Few-shot training</h3>
<p>Few-shot prompting improves an AI agent's ability to generate accurate responses by providing it with a few examples before asking it to perform a task. Instead of relying purely on pre-trained knowledge, the model learns from sample interactions, helping it generalize patterns and reduce errors.</p>
<p>For instance, in a customer support AI, showing examples of refund requests and troubleshooting responses allows the model to infer how to handle similar queries effectively.</p>
<pre><code class="lang-bash">You are a customer support AI. Use the examples below to understand how to respond.

Example 1:
Customer: <span class="hljs-string">"I want a refund for my order."</span>
AI: <span class="hljs-string">"Our refund policy allows returns within 30 days. Please provide your order number, and I'll assist you further."</span>

Example 2:
Customer: <span class="hljs-string">"My product isn't working. What should I do?"</span>
AI: <span class="hljs-string">"I'm sorry to hear that! Can you describe the issue? Meanwhile, you can check our troubleshooting guide [link]."</span>

Now, respond to the following query:
Customer: <span class="hljs-string">"I received the wrong item. What should I do?"</span>
</code></pre>
<h3 id="heading-2-memory-augmented-prompting-rag-based">2. Memory-augmented prompting (RAG-based)</h3>
<p>Memory-Augmented Prompting (RAG-Based) enhances AI responses by retrieving relevant external data instead of relying solely on pre-trained knowledge. This approach is particularly useful when dealing with dynamic or domain-specific information.</p>
<p>Using Langbase, you can create memory agents for this. Langbase memory agents are a managed context search API for developers. They’re a helpful long-term memory solution that can acquire, process, retain, and later retrieve information. Memory agents combine vector storage, RAG (Retrieval-Augmented Generation), and internet access to help you build powerful AI features and products.</p>
<p>By incorporating Langbase with a Retrieval Augmented Generation (RAG) system, Memory is used with a Pipe agent to retrieve relevant data for queries.</p>
<p>The process involves:</p>
<ul>
<li><p>Creating query embeddings.</p>
</li>
<li><p>Retrieving matching data from Memory.</p>
</li>
<li><p>Augmenting the query with this data of 3-20 chunks.</p>
</li>
<li><p>Using it to generate accurate, context-aware responses.</p>
</li>
</ul>
<h3 id="heading-rag-prompt">RAG prompt</h3>
<p>When a memory is attached to a Pipe agent, by default a RAG prompt appears which is fed to LLM to utilize the memory. Default prompt works fine in most cases, but you can customize the prompt based on your use case.</p>
<p><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcxZ-2ydsO9AoNFxGGLnLXalLgm6s4mr6TvJPGclnCGf9vIC1FM-nibFRUQLUfKLZMLq-HSUWF-gOkWY9JO5kdiVsCgW8ZCxS_Z5sL7bWVSVlKTq77qt8Q5d4rlqpooPlR4ARyAjQ?key=Q-k-bEK6x7APjPtDCPcYSPKJ" alt="RAG prompt" width="1600" height="908" loading="lazy"></p>
<p>You can learn how to build RAG by following this step-by-step <a target="_blank" href="https://langbase.com/docs/guides/rag">guide.</a></p>
<h3 id="heading-3-chain-of-thought-cot-prompting">3. Chain of Thought (CoT) prompting</h3>
<p>CoT prompting helps AI agents break down complex problems into logical steps before answering. Instead of jumping to conclusions, the model is guided to reason through the problem systematically.</p>
<p>This prompting technique is great when you need the "how" behind the answer. It is especially useful for tasks requiring multi-step reasoning, such as debugging code.</p>
<p>For example, a coding AI agent can analyze an issue with the following prompt:</p>
<pre><code class="lang-bash">Analyze the following error message and identify possible causes. Then, <span class="hljs-built_in">break</span> down the debugging steps to fix the issue.
</code></pre>
<p>This approach leads to more accurate and reliable responses by encouraging deeper reasoning rather than generating a hasty answer.</p>
<h3 id="heading-4-role-based-prompting">4. Role-based prompting</h3>
<p>Role-based prompting helps AI agents generate more precise and context-aware responses by assigning them a specific identity. Instead of providing generic answers, the model adopts the characteristics of a domain expert, leading to better accuracy and relevance.</p>
<p>For example, in a cybersecurity AI agent, defining its role as a security expert ensures its responses prioritize risk assessment and best practices. A sample prompt could be:</p>
<pre><code class="lang-bash">You are a cybersecurity expert. Identify vulnerabilities <span class="hljs-keyword">in</span> the given code and suggest fixes.
</code></pre>
<p>This approach narrows the LLM model’s focus, helping it analyze threats more effectively rather than offering broad, unstructured advice.</p>
<h3 id="heading-5-react-reasoning-acting-prompting">5. ReACT (Reasoning + Acting) prompting</h3>
<p>This enables AI agents to make decisions by alternating between logical reasoning and real-world actions. Instead of generating static responses, the model interacts dynamically with tools, APIs, or databases to fetch and process information.</p>
<p>For example, a personal assistant AI booking flights might use a prompt like:</p>
<pre><code class="lang-bash">Check flight availability <span class="hljs-keyword">for</span> [destination] on [date]. If no flights are found, suggest alternative dates.
</code></pre>
<p>This approach ensures the agent doesn’t hallucinate results—it retrieves real data, evaluates it, and adjusts its actions accordingly, making responses more reliable and grounded in actual outcomes. This technique integrates reasoning with real-time decision-making in agents. It’s perfect for dynamic, on-the-fly problem-solving.</p>
<h3 id="heading-6-safety-prompts">6. Safety prompts</h3>
<p>Langbase AI studio has a separate section that lets you define safety prompts inside a Pipe agent. For instance, do not answer questions outside of the given context.</p>
<p>One of its use cases can be to ensure the LLM does not provide any sensitive information in its response from the provided context.</p>
<p><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXc2pQ9a1xgRcow-Pit-Ay1O9W7G49DLx7jkFHlwtNLTCOu1PAUnO55IoBgW2dc0F1A6lo2FSTOSe_Lq020YcsNjBSrIhIBn4msooMh2nw0MMAYq6LHRaw0jSNMaMNjHoixcjIwDmg?key=Q-k-bEK6x7APjPtDCPcYSPKJ" alt="Safety prompts" width="1600" height="932" loading="lazy"></p>
<p>Learn how to define safety instructions for any LLM inside a pipe <a target="_blank" href="https://langbase.com/docs/features/safety">here.</a></p>
<h2 id="heading-how-to-fine-tune-the-llms-response-parameters">How to Fine-Tune the LLM’s Response Parameters</h2>
<p>Now that you know the techniques to design strong prompts for your Pipe agents, let's take this further by adjusting model parameters like temperature, maximum tokens, top_p, and others to refine how the model responds to user queries.</p>
<p>Here are the LLM parameters that you can tweak to build efficient Pipe agents:</p>
<ul>
<li><p><strong>Precise:</strong> Tuned for precise and accurate responses.</p>
</li>
<li><p><strong>Balanced:</strong> Strikes a balance between accuracy and creativity.</p>
</li>
<li><p><strong>Creative:</strong> Prioritizes creativity and diversity in the generated responses.</p>
</li>
<li><p><strong>Custom:</strong> Allows you to manually configure the response parameters.</p>
</li>
<li><p><strong>JSON_mode:</strong> Ensures the model will always output valid JSON.</p>
</li>
<li><p><strong>Temperature:</strong> Control how creative the LLM is with the outputs.</p>
</li>
<li><p><strong>Max_tokens:</strong> Specifies the maximum number of tokens that can be generated in the output.</p>
</li>
<li><p><strong>Frequency Penalty:</strong> Prevents the model from repeating a word that was too recently used/used too often.</p>
</li>
<li><p><strong>Presence Penalty:</strong> Prevents the model from repeating a word.</p>
</li>
<li><p><strong>Top_p:</strong> Generate tokens until the cumulative probability exceeds the chosen threshold.</p>
</li>
</ul>
<p><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXe2h29LWOzyHlHJ5fzPDIBpkJhHcsZYUXvtaBki-IYWEWrE0wrTGDFL-_VIcBsqqtjvb8OTr7_FHayhMlfdE5PXyJfFvqgSuSBPfh5QEU_AllCQg1MNsoYe-DZ-04g4zmxPE_PwyQ?key=Q-k-bEK6x7APjPtDCPcYSPKJ" alt="Fine-tune LLM model’s response parameters" width="1600" height="932" loading="lazy"></p>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>Building effective serverless AI agents becomes easier if you use these prompt engineering techniques. You can give it a try by creating your own Pipe agent by visiting <a target="_blank" href="http://pipe.new">pipe.new</a>.</p>
<p>Thank you for reading!</p>
<p>Connect with me by 🙌:</p>
<ul>
<li><p>Subscribing to my <a target="_blank" href="https://www.youtube.com/@AIwithMahamCodes">YouTube</a> Channel. If you are willing to learn about AI and agents.</p>
</li>
<li><p>Subscribing to my free newsletter <a target="_blank" href="https://mahamcodes.substack.com/">“The Agentic Engineer”</a> where I share all the latest AI and agents news/trends/jobs and much more.</p>
</li>
<li><p>Follow me on <a target="_blank" href="https://x.com/MahamDev">X (Twitter)</a>.</p>
</li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
