How to build a social media assistant with Prompty and PromptFlow
How to build a social media assistant with Prompty and PromptFlow
Why Prompty.
Specification: Prompty is an asset class not tied to any language as it uses markdown format with yaml to specify your metadata. It unifies the prompt and its execution in a single package to quickly get started.
Tooling: using the Prompty extension, you can quickly get started in your coding environment and set up your configuration. It enables you to work with prompts at a high level with additional features such as metadata autocompletion, syntax highlighting, quick run and validation.
Runtime: Prompty additionally generates code for you in different frameworks e.g. LangChain, PromptFlow and Semantic Kernel. the asset class easily helps you convert to code simplifying your workflow as it is language agnostic.
Prerequisites and Authentication
To get started, you need to create a new Azure OpenAI resource on the Azure OpenAI Studio.
Once you create the resource, head over to Azure OpenAI Studio and create a gpt-35-turbo model deployment.
The first, and easiest way, to get started is by using environment variables. In your local environment, create a .env file, where you store your keys and endpoints. Your .env file, should be something like this:
AZURE_OPENAI_DEPLOYMENT_NAME = “”
AZURE_OPENAI_API_VERSION = “”
AZURE_OPENAI_API_VERSION = “”
AZURE_OPENAI_ENDPOINT =””
type: azure_openai
azure_deployment: ${env:AZURE_OPENAI_DEPLOYMENT_NAME}
api_version: ${env:AZURE_OPENAI_API_VERSION}
azure_endpoint: ${env:AZURE_OPENAI_ENDPOINT}
You can also, login to your Azure account using azd auth login –use-device-code, this will allow you to define your model configurations and update your settings.json files, allowing you to access your configurations without using environment variable.
Getting Started with Prompty
Install the Prompty extension
Right-click on the VSCode explorer and select “New Prompty.” This will create a new Prompty file in markdown format.
Configure your application metadata, in this case we will update as follows:
name: SociallyPrompt
description: An AI assistant designed to help you create engaging Twitter and LinkedIn posts
authors:
model:
azure_endpoint: azure_openai
azure_deployment: gpt-35-turbo
parameters:
max_tokens: 3000
temperature: 0.9
sample:
blog_title: LLM based development tools – PromptFlow vs LangChain vs Semantic Kernel
blog_link: https://techcommunity.microsoft.com/t5/educator-developer-blog/llm-based-development-tools-promptflow-vs-langchain-vs-semantic/ba-p/4149252
call_to_action: GitHub Sample Code at https://github.com/BethanyJep/Swahili-Tutor
post type: Twitter
Update your application instructions, use examples where necessary, for example, below is a sample instruction for our social media assistant:
You are an Social Media AI assistant who helps people create engaging content for Twitter. As the assistant,
you keep the tweets concise – remember that 280-character limit! Inject enthusiasm into your posts!
Use relevant hashtags to boost visibility for the posts. And have a call to action or even add some personal flair with appropriate emojis.
# Context
I am an AI assistant designed to help you create engaging Twitter and LinkedIn posts. I can help you create posts for a variety of topics, including technology, education, and more. I can also help you create posts for blog posts, articles, and other content you want to share on social media.
user:
{{post_type}} post for the blog post titled “{{blog_title}}” found at {{blog_link}} with the call to action “{{call_to_action}}”.
Once done click the run button to run your Prompty in the terminal
Extending functionality with Promptflow
Tracing your Flow
Resources
Our Social Media Assistant Prompty: BethanyJep/social-media-assistant-prompty (github.com)
Microsoft Build: Practical End-to-End AI Development using Prompty and AI Studio (microsoft.com)
Prompty samples: Collections | Microsoft Learn
Prompty documentations: prompty.ai
Microsoft Tech Community – Latest Blogs –Read More