mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
ollama improvements + version bump
This commit is contained in:
parent
b7e3fbc22b
commit
e354f39cc1
1 changed files with 29 additions and 20 deletions
|
|
@ -19,10 +19,9 @@
|
|||
# def test_completion_ollama():
|
||||
# try:
|
||||
# response = completion(
|
||||
# model="llama2",
|
||||
# model="ollama/llama2",
|
||||
# messages=messages,
|
||||
# api_base="http://localhost:11434",
|
||||
# custom_llm_provider="ollama"
|
||||
# api_base="http://localhost:11434"
|
||||
# )
|
||||
# print(response)
|
||||
# except Exception as e:
|
||||
|
|
@ -35,20 +34,43 @@
|
|||
# messages = [{ "content": user_message,"role": "user"}]
|
||||
# try:
|
||||
# response = completion(
|
||||
# model="llama2",
|
||||
# model="ollama/llama2",
|
||||
# messages=messages,
|
||||
# api_base="http://localhost:11434",
|
||||
# custom_llm_provider="ollama",
|
||||
# stream=True
|
||||
# )
|
||||
# print(response)
|
||||
# for chunk in response:
|
||||
# print(chunk['choices'][0]['delta'])
|
||||
# print(chunk)
|
||||
# # print(chunk['choices'][0]['delta'])
|
||||
|
||||
# except Exception as e:
|
||||
# pytest.fail(f"Error occurred: {e}")
|
||||
|
||||
# # test_completion_ollama_stream()
|
||||
# test_completion_ollama_stream()
|
||||
|
||||
|
||||
# async def test_completion_ollama_async_stream():
|
||||
# user_message = "what is the weather"
|
||||
# messages = [{ "content": user_message,"role": "user"}]
|
||||
# try:
|
||||
# response = await litellm.acompletion(
|
||||
# model="ollama/llama2",
|
||||
# messages=messages,
|
||||
# api_base="http://localhost:11434",
|
||||
# stream=True
|
||||
# )
|
||||
# async for chunk in response:
|
||||
# print(chunk)
|
||||
|
||||
# # print(chunk['choices'][0]['delta'])
|
||||
|
||||
# except Exception as e:
|
||||
# pytest.fail(f"Error occurred: {e}")
|
||||
|
||||
# import asyncio
|
||||
# asyncio.run(test_completion_ollama_async_stream())
|
||||
|
||||
|
||||
|
||||
# def prepare_messages_for_chat(text: str) -> list:
|
||||
|
|
@ -62,30 +84,17 @@
|
|||
# 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())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue