mirror of
https://github.com/amithkoujalgi/ollama4j.git
synced 2025-11-03 01:50:42 +01:00
updated docs
This commit is contained in:
@@ -4,40 +4,27 @@ sidebar_position: 1
|
||||
|
||||
# List Models
|
||||
|
||||
Add **Markdown or React** files to `src/pages` to create a **standalone page**:
|
||||
This API lets you list available models on the Ollama server.
|
||||
|
||||
- `src/pages/index.js` → `localhost:3000/`
|
||||
- `src/pages/foo.md` → `localhost:3000/foo`
|
||||
- `src/pages/foo/bar.js` → `localhost:3000/foo/bar`
|
||||
```java title="ListModels.java"
|
||||
public class ListModels {
|
||||
|
||||
## Create your first React Page
|
||||
public static void main(String[] args) {
|
||||
|
||||
Create a file at `src/pages/my-react-page.js`:
|
||||
String host = "http://localhost:11434/";
|
||||
|
||||
```jsx title="src/pages/my-react-page.js"
|
||||
import React from 'react';
|
||||
import Layout from '@theme/Layout';
|
||||
OllamaAPI ollamaAPI = new OllamaAPI(host);
|
||||
|
||||
export default function MyReactPage() {
|
||||
return (
|
||||
<Layout>
|
||||
<h1>My React page</h1>
|
||||
<p>This is a React page</p>
|
||||
</Layout>
|
||||
);
|
||||
List<Model> models = ollamaAPI.listModels();
|
||||
|
||||
models.forEach(model -> System.out.println(model.getName()));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
A new page is now available at [http://localhost:3000/my-react-page](http://localhost:3000/my-react-page).
|
||||
If you have any models already downloaded on Ollama server, you would have them listed as follows:
|
||||
|
||||
## Create your first Markdown Page
|
||||
|
||||
Create a file at `src/pages/my-markdown-page.md`:
|
||||
|
||||
```mdx title="src/pages/my-markdown-page.md"
|
||||
# My Markdown page
|
||||
|
||||
This is a Markdown page
|
||||
```
|
||||
|
||||
A new page is now available at [http://localhost:3000/my-markdown-page](http://localhost:3000/my-markdown-page).
|
||||
```bash
|
||||
llama2:latest
|
||||
sqlcoder:latest
|
||||
```
|
||||
Reference in New Issue
Block a user