fix(main.py): expose custom llm provider for text completions

This commit is contained in:
Krrish Dholakia 2023-11-02 07:55:54 -07:00
parent a652f05bb3
commit 943f9d9432
2 changed files with 3 additions and 11 deletions

View file

@ -496,7 +496,8 @@ def completion(
additional_args={"headers": headers}, additional_args={"headers": headers},
) )
elif ( elif (
model in litellm.open_ai_text_completion_models custom_llm_provider == "text-completion-openai"
or model in litellm.open_ai_text_completion_models
or "ft:babbage-002" in model or "ft:babbage-002" in model
or "ft:davinci-002" in model # support for finetuned completion models or "ft:davinci-002" in model # support for finetuned completion models
# NOTE: Do NOT add custom_llm_provider == "openai". # NOTE: Do NOT add custom_llm_provider == "openai".

View file

@ -426,21 +426,12 @@ def test_completion_hf_prompt_array():
# test_completion_hf_prompt_array() # test_completion_hf_prompt_array()
def test_completion_text_openai(): def test_completion_text_openai():
try:
# litellm.set_verbose=True
response = completion(model="text-davinci-003", messages=messages)
# Add any assertions here to check the response
print(response)
except Exception as e:
pytest.fail(f"Error occurred: {e}")
def test_completion_gpt_instruct():
try: try:
response = completion(model="gpt-3.5-turbo-instruct", messages=messages) response = completion(model="gpt-3.5-turbo-instruct", messages=messages)
print(response) print(response)
except Exception as e: except Exception as e:
pytest.fail(f"Error occurred: {e}") pytest.fail(f"Error occurred: {e}")
# test_completion_gpt_instruct() test_completion_text_openai()
def test_completion_openai_with_optional_params(): def test_completion_openai_with_optional_params():
try: try: