Skip to content

Commit

Permalink
upgrade openai interface
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 588770215
Change-Id: I9410c18cb6c66a229b8fbbc3db62ff2f2315a5c6
  • Loading branch information
vezhnick authored and copybara-github committed Dec 7, 2023
1 parent 0fe97c5 commit 393c48c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion concordia/language_model/gpt_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand Down

0 comments on commit 393c48c

Please sign in to comment.