Skip to content
项目

Azure-Samples/ollama-javascript-playground

在 GitHub 查看

关于

Generative AI playground using Ollama, OpenAI API and JavaScript. Try AI models in your browser!

人工智能与机器学习

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Ollama JavaScript Playground

Open project in GitHub Codespaces Node version JavaScript License

⭐ If you like this repo, star it on GitHub — it helps a lot!

Overview • Usage • Run the samples • Next steps • Resources

Overview

Try out generative AI models right in your browser for free using this playground! ✨

Using GitHub Codespaces and Ollama, you'll be able to run SLMs (Small Language Models) such as Phi-3 directly in your browser, without having to install anything.

Usage

This project is designed to be opened in GitHub Codespaces, which provides you a pre-configured environment to run the code and AI models. Follow these steps to get started:

  1. Click on the "Codespaces: Open" button:
    Open project in GitHub Codespaces

  2. Once the Codespace is loaded, it should have Ollama pre-installed as well as the OpenAI Node SDK.

  3. Ask Ollama to run the SLM of your choice. For example, to run the Phi-3 model:

    ollama run phi3
    

    That will take a few seconds to load the model.

  4. Once you see >>> in the output, you can send a message to that model from the prompt.

    >>> Write a haiku about a furry kitten
    
  5. After several seconds, you should see a response stream in from the model.

  6. Close the model by typing /bye and pressing Enter.

  7. Open the file ollama.ipynb in the editor and follow the instructions.

[!TIP] While you're following the instructions of the interactive notebook, you can run the code cells by clicking on the "Execute cell" (▶️) button in the top left corner of the cell. You can also edit the code and run it again to see how the model responds to different inputs. Screenshot of a code cell highlighting the "executing cell" button

Run the samples

In the samples folder of this repository, you'll find examples of how to use generative AI models using the OpenAI Node.js SDK. You can run them by executing the following command in the terminal:

tsx samples/<filename>

Alternatively, you can open a sample file in the editor and run it directly by clicking the "Run" (▶️) button in the top right corner of the editor.

[!IMPORTANT] Some samples requires you to start the Azure OpenAI emulator first. You can do so by running the following command in a terminal and keeping it running while you run the samples:

ollamazure -d

Next steps

Once you're comfortable with this playground, you can explore more advanced topics and tutorials:

When you're ready to explore how you can deploy generative using Azure, you should check out these resources:

Resources

Here are some additional resources to help you learn more about generative AI:

Other playgrounds in different languages:

探索相关项目

加载中…