Skip to content

Commit

Permalink
Update rank_gpt.py
Browse files Browse the repository at this point in the history
Update support for Openai, Claude, and Litelm
  • Loading branch information
sunnweiwei authored Jan 20, 2024
1 parent b97cbb1 commit b925e41
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rank_gpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def text(self, max_tokens=None, return_text=True, *args, **kwargs):


class LitellmClient:
# https://github.com/BerriAI/litellm
def __init__(self, keys=None):
self.api_key = keys

Expand All @@ -85,8 +86,9 @@ def chat(self, return_text=True, *args, **kwargs):
response = response.choices[0].message.content
return response


def convert_messages_to_prompt(messages):
# used for completion model (not chat model)
# convert chat message into a single prompt; used for completion model (eg davinci)
prompt = ''
for turn in messages:
if turn['role'] == 'system':
Expand Down

0 comments on commit b925e41

Please sign in to comment.