Untitled

mail@pastecode.io avatar
unknown
plain_text
16 days ago
433 B
2
Indexable
Never
response = openai.ChatCompletion.create(
        model="gpt-4",
        messages=messages,
        max_tokens=150  # Adjust max_tokens based on your needs
    )

    # Extract the response content
    completion = response['choices'][0]['message']['content'].strip()
    assistant_response = json.loads(completion)

    # Parse the assistant response into UserInfo
    user_info = UserInfo(**assistant_response)

    return user_info
Leave a Comment