nonhuman commited on
Commit
c7bc1e4
1 Parent(s): 9b364f5

Create cookbook/liteLLM_Ollama.ipynb

Browse files
Files changed (1) hide show
  1. cookbook/liteLLM_Ollama.ipynb +11 -0
cookbook/liteLLM_Ollama.ipynb ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from litellm import completion
2
+
3
+ response = completion(
4
+ model="ollama/llama2",
5
+ messages=[{ "content": "respond in 20 words. who are you?","role": "user"}],
6
+ api_base="http://localhost:11434",
7
+ stream=True
8
+ )
9
+ print(response)
10
+ for chunk in response:
11
+ print(chunk['choices'][0]['delta'])