new ollama test

This commit is contained in:
ishaan-jaff 2023-09-21 10:39:46 -07:00
parent 35bb6f5a50
commit cf97a9441a

View file

@ -49,3 +49,43 @@
# pytest.fail(f"Error occurred: {e}")
# # test_completion_ollama_stream()
# def prepare_messages_for_chat(text: str) -> list:
# messages = [
# {"role": "user", "content": text},
# ]
# return messages
# async def ask_question():
# params = {
# "messages": prepare_messages_for_chat("What is litellm? tell me 10 things about it who is sihaan.write an essay"),
# "api_base": "http://localhost:11434",
# # "custom_llm_provider": "ollama",
# "model": "ollama/llama2",
# # "model": "gpt-3.5-turbo",
# # "api_key": os.environ["OPENAI_API_KEY"],
# "stream": True,
# }
# # response = litellm.completion(**params, max_tokens=10)
# # print(response)
# # for c in response:
# # print(c)
# response = await litellm.acompletion(**params)
# print(response)
# return response
# async def main():
# response = await ask_question()
# print(response)
# async for chunk in response:
# print(chunk)
# if __name__ == "__main__":
# import asyncio
# asyncio.run(main())