diff --git a/concordia/language_model/gpt_model.py b/concordia/language_model/gpt_model.py index 3dfb5e9c..de9fadbf 100644 --- a/concordia/language_model/gpt_model.py +++ b/concordia/language_model/gpt_model.py @@ -47,6 +47,9 @@ def __init__( self._model_name = model_name self._measurements = measurements self._channel = channel + self._client = openai.OpenAI( + api_key=api_key, + ) @override def sample_text( @@ -61,7 +64,8 @@ def sample_text( seed: int | None = None, ) -> str: messages = [{'role': 'user', 'content': prompt}] - response = openai.ChatCompletion.create( + + response = openai.chat.completions.create( api_key=self._api_key, model=self._model_name, messages=messages,