A prompt contains natural-language instructions for the LLM that detail everything the agent does, how it does those things, and what it shouldn’t do. Our prompt will explain to the LLM how it should behave as a weather agent.

You can create the prompt using the sample code below.

from syllable_sdk import PromptCreateRequest, PromptLlmConfig, PromptLlmProvider, SyllableSDK

sdk = SyllableSDK(
api_key_header='your_key_here'
)

prompt = sdk.prompts.create(request=PromptCreateRequest(
# The name of the prompt is used to reference it elsewhere in the system, so
# you should pick something that's easily identifiable.
name='Weather Prompt3',
# The description is displayed for extra context on the prompt list screen in
# the Syllable Console.
description='Prompt for a weather agent',
# The type of the prompt. Can just be hardcoded to `prompt_v1` for now.
type='prompt_v1',
# The actual text of the prompt that will be sent to the LLM at the beginning
# of the conversation.
context='''You are a weather agent. You can tell the user information about the current weather in a given city, and also answer general weather-related questions.

When asked about any other topic, don't answer and instead remind the caller that you are a weather agent. Keep the tone professional, friendly, and clear. You are chatting with a user, so always respond naturally and conversationally. Do not use nonverbal cues, describe system actions, or add any other information.''',
# Names of the tools to which the prompt has access. We'll fill these in later.
tools=[],
# For a list of all supported LLMs, see "Console prompts docs" below.
llm_config=PromptLlmConfig(
provider=PromptLlmProvider.OPENAI,
model='gpt-4o',
version='2024-08-06',
api_version=None
),
# Whether to give the prompt access to default tools. You can leave this
# false for now.
include_default_tools=False
))

print(prompt)

We now have the prompt that will explain to the LLM how it should behave as a weather agent, but there are no instructions regarding how to actually the fetch weather information that it’s supposed to provide to the user. We’ll be setting that up in the next couple steps.

Before you move on, note the ID of the prompt that you created, as you’ll need it later.

Click “Create a data source” below to continue the tutorial.

📚 Documentation References