Created
March 11, 2024 20:15
-
-
Save fsndzomga/c5653ed8b27692b641c1538690d76ba1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pydantic import BaseModel | |
from anonLLM.llm import OpenaiLanguageModel | |
from dotenv import load_dotenv | |
load_dotenv() | |
llm = OpenaiLanguageModel(anonymize=False, temperature=1) | |
class Person(BaseModel): | |
name: str | |
sex: str | |
age: int | |
email: str | |
response = llm.generate( | |
prompt="Generate a person", | |
output_format=Person | |
) | |
print(response) | |
# Returns: {'name': 'Alex', 'sex': 'Male', 'age': 32, 'email': '[email protected]'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment