- Notifications
You must be signed in to change notification settings - Fork18
A dev container with ollama and ollama examples with the Python OpenAI SDK
License
pamelafox/ollama-python-playground
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This project is designed to be opened in GitHub Codespaces as an easy way for anyone to try out SLMs (small language models) entirely in the browser.
Open the Codespace in the browser using the
Code
button at the top of the repository.Once the Codespace is loaded, it should haveollama pre-installed as well as theOpenAI Python SDK.
Ask Ollama to run the SLM of your choice. For example, to run thephi3 model:
ollama run phi3:mini
That will take a few minutes to download the model into the Codespace.
Once you see "success" in the output, you can send a message to that model from the prompt.
>>> Write a haiku about hungry hippos
After several seconds, you should see a response stream in from the model.
To learn about different techniques used with language models, open the Python notebook
ollama.ipynb
and run each cell . If you used a model other than 'phi3:mini', change theMODEL_NAME
in the first cell.To have a conversation with a model from Python, open the Python file
chat_history.py
and run it. You can change theMODEL_NAME
at the top of the file as needed, and you can also modify the system message or add few-shot examples if desired.
For more information about working with the Phi-3 model, check out thePhi-3 Cookbook.
To learn more about generative AI generally, check outGenerative AI for beginners.
For example code that works with OpenAI models as well, trypython-openai-demos.
About
A dev container with ollama and ollama examples with the Python OpenAI SDK
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.