diff --git a/litellm/main.py b/litellm/main.py index 160f786f5f..a11c5826ca 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -1432,7 +1432,7 @@ def text_completion(*args, **kwargs): kwargs["messages"] = messages kwargs.pop("prompt") response = completion(*args, **kwargs) # assume the response is the openai response object - response_2 = { + formatted_response_obj = { "id": response["id"], "object": "text_completion", "created": response["created"], @@ -1447,7 +1447,7 @@ def text_completion(*args, **kwargs): ], "usage": response["usage"] } - return response_2 + return formatted_response_obj else: raise ValueError("please pass prompt into the `text_completion` endpoint - `text_completion(model, prompt='hello world')`") diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index 6aec8afe16..34fa7a7a39 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -346,12 +346,7 @@ def test_completion_openai_prompt(): response = text_completion( model="gpt-3.5-turbo", prompt="What's the weather in SF?" ) - response_str = response["choices"][0]["message"]["content"] - response_str_2 = response.choices[0].message.content - print(response) - assert response_str == response_str_2 - assert type(response_str) == str - assert len(response_str) > 1 + response_str = response["choices"][0]["text"] except Exception as e: pytest.fail(f"Error occurred: {e}") diff --git a/pyproject.toml b/pyproject.toml index 504f64bfb4..0a56cdf537 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "litellm" -version = "0.1.791" +version = "0.1.792" description = "Library to easily interface with LLM API providers" authors = ["BerriAI"] license = "MIT License"