Skip to content

Commit

Permalink
Search: use gpt-4-1106-preview model
Browse files Browse the repository at this point in the history
  • Loading branch information
YuraLukashik committed Nov 6, 2023
1 parent c3c0d69 commit 8a5e581
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ def create_embeddings(texts: List[str]) -> List[Any]:

@retry(delay=3, backoff=2, tries=8)
def gpt_query(query: str) -> str:
max_tokens = 3300 - estimate_tokens_number(query)
completion = openai.Completion.create(model="gpt-3.5-turbo-instruct", prompt=query, max_tokens=max_tokens)
return completion.choices[0].text.strip()
summary = openai.ChatCompletion.create(
model="gpt-4-1106-preview",
messages=[{"role": "user", "content": query}],
response_format={"type": "json_object"},
)
return summary.choices[0].message.content.strip()


def estimate_tokens_number(text: str) -> int:
Expand Down

0 comments on commit 8a5e581

Please sign in to comment.