Skip to content

Instantly share code, notes, and snippets.

@adlumal
adlumal / goalchain_example.py
Last active May 26, 2024 09:07
GoalChain example
from goalchain import Field, ValidationError, Goal, GoalChain
import os
os.environ["OPENAI_API_KEY"] = "sk-ABC..." # SPECIFY OPENAI API KEY
def quantity_validator(value):
try:
value = int(value)
except (ValueError, TypeError):
raise ValidationError("Quantity must be a valid number")