Deprecated: AI answer verification
The requires-expert
metadata attribute is now deprecated. Please use mode
instead. See Conversation modes page
Pearl API allows you to have an AI-generated answer verified by a human Expert. To request expert review, include the additional metadata attribute "mode" with a value of "pearl-ai-verified".
from uuid import uuid4
from openai import OpenAI
client = OpenAI(
api_key="PEARL_API_KEY",
base_url="https://api.pearl.com/api/v1/"
)
session_id = str(uuid4()) # Generate a unique GUID
response = client.chat.completions.create(
model="pearl-ai",
messages=[
{
"role": "user",
"content": "Explain to me how AI works"
}
],
metadata={"sessionId": session_id, "mode": "pearl-ai-verified"}
)
print(response.choices[0].message)
When you request verification of an AI-generated answer, the process may take some time as it is being done by a human Expert. The verification duration depends on factors such as answer complexity and expert availability. If you wish to get an AI answer verification or connect with a real human Expert, you must implement automatic retries or setup webhook callbacks.
Conversation modes