Untitled

 avatar
unknown
plain_text
a year ago
433 B
4
Indexable
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
Editor is loading...
Leave a Comment