Use Cases
Detecting Emotions with GPT-4o
Getting Started
Integrations
Use Cases
- Overview
- Few-Shot Prompting
- Enforcing JSON Schema with Anyscale & Together
- Detecting Emotions with GPT-4o
- Build an article suggestion app with Supabase pgvector, and Portkey
- Setting up resilient Load balancers with failure-mitigating Fallbacks
- Run Portkey on Prompts from Langchain Hub
- Smart Fallback with Model-Optimized Prompts
- How to use OpenAI SDK with Portkey Prompt Templates
- Setup OpenAI -> Azure OpenAI Fallback
- Fallback from SDXL to Dall-e-3
- Comparing Top10 LMSYS Models with Portkey
- Build a chatbot using Portkey's Prompt Templates
Use Cases
Detecting Emotions with GPT-4o
First, grab the API keys
Portkey API Key | OpenAI API Key |
---|
pip install -qU portkey-ai openai
Let’s make a request
from openai import OpenAI
from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders
portkey = OpenAI(
api_key = 'OPENAI_API_KEY',
base_url = PORTKEY_GATEWAY_URL,
default_headers = createHeaders(
provider = "openai",
api_key = 'PORTKEY_API_KEY'
)
)
emotions = portkey.chat.completions.create(
model = "gpt-4o",
messages = [{"role": "user","content":
[
{"type": "image_url","image_url": {"url": "https://i.insider.com/602ee9d81a89f20019a377c6?width=1136&format=jpeg"}},
{"type": "text","text": "What expression is this person expressing?"}
]
}
]
)
print(emotions.choices[0].message.content)