Updated docs

This commit is contained in:
Amith Koujalgi 2023-12-26 15:32:00 +05:30
parent 154d7cca78
commit e75878d248
2 changed files with 55 additions and 26 deletions

View File

@ -2,46 +2,75 @@
sidebar_position: 1 sidebar_position: 1
--- ---
# Tutorial Intro # Intro
Let's discover **Docusaurus in less than 5 minutes**. Let's discover **Ollama4J in less than 5 minutes**.
## Getting Started ## Getting Started
Get started by **creating a new site**.
Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new)**.
### What you'll need ### What you'll need
- [Node.js](https://nodejs.org/en/download/) version 18.0 or above: - **[Ollama](https://ollama.ai/download)**
- When installing Node.js, you are recommended to check all checkboxes related to dependencies. - **[Oracle JDK](https://www.oracle.com/java/technologies/javase/jdk11-archive-downloads.html)** or
**[Open JDK](https://jdk.java.net/archive/)** 11.0 or above.
- **[Maven](https://maven.apache.org/download.cgi)** or **[Gradle](https://gradle.org/install/)**
## Generate a new site ### Start Ollama server
Generate a new Docusaurus site using the **classic template**. The easiest way of getting started with Ollama server is with *
*[Docker](https://docs.docker.com/get-started/overview/)**. But if you choose to run the
Ollama server directly, **[download](https://ollama.ai/download)** the distribution of your choice
and follow the installation process.
The classic template will automatically be added to your project after you run the command: #### With Docker
##### Run in CPU mode:
```bash ```bash
npm init docusaurus@latest my-website classic docker run -it -v ~/ollama:/root/.ollama -p 11434:11434 ollama/ollama
``` ```
You can type this command into Command Prompt, Powershell, Terminal, or any other integrated terminal of your code editor. ##### Run in GPU mode:
The command also installs all necessary dependencies you need to run Docusaurus.
## Start your site
Run the development server:
```bash ```bash
cd my-website docker run -it --gpus=all -v ~/ollama:/root/.ollama -p 11434:11434 ollama/ollama
npm run start
``` ```
The `cd` command changes the directory you're working with. In order to work with your newly created Docusaurus site, you'll need to navigate the terminal there. You can type this command into Command Prompt, Powershell, Terminal, or any other integrated
terminal of your code editor.
The `npm run start` command builds your website locally and serves it through a development server, ready for you to view at http://localhost:3000/. The command runs the Ollama server locally at **http://localhost:11434/**.
Open `docs/intro.md` (this page) and edit some lines: the site **reloads automatically** and displays your changes. ### Start your project
Get started by **creating a new Maven project** on your favorite IDE.
Add the dependency to your project.
```xml
<dependency>
<groupId>io.github.amithkoujalgi</groupId>
<artifactId>ollama4j</artifactId>
<version>1.0.27</version>
</dependency>
```
Create a new Java class in your project and add this code.
```java
public class OllamaAPITest {
public static void main(String[] args) {
String host = "http://localhost:11434/";
OllamaAPI ollamaAPI = new OllamaAPI(host);
ollamaAPI.setVerbose(true);
boolean isOllamaServerReachable = ollamaAPI.ping();
System.out.println("Is Ollama server alive: " + isOllamaServerReachable);
}
}
```

View File

@ -44,14 +44,14 @@ const config = {
// Please change this to your repo. // Please change this to your repo.
// Remove this to remove the "edit this page" links. // Remove this to remove the "edit this page" links.
editUrl: editUrl:
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/', 'https://github.com/amithkoujalgi/ollama4j',
}, },
blog: { blog: {
showReadingTime: true, showReadingTime: true,
// Please change this to your repo. // Please change this to your repo.
// Remove this to remove the "edit this page" links. // Remove this to remove the "edit this page" links.
editUrl: editUrl:
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/', 'https://github.com/amithkoujalgi/ollama4j',
}, },
theme: { theme: {
customCss: './src/css/custom.css', customCss: './src/css/custom.css',