{"id":21864161,"url":"https://github.com/prostdev/mac-ollama-proj","last_synced_at":"2025-03-21T20:44:22.052Z","repository":{"id":264883808,"uuid":"891219849","full_name":"ProstDev/mac-ollama-proj","owner":"ProstDev","description":"Simple Mule application making use of the MAC (MuleSoft AI Chain) project to connect to Ollama AI (llama3 model).","archived":false,"fork":false,"pushed_at":"2024-12-04T19:00:04.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T15:29:22.844Z","etag":null,"topics":["ai","anypoint-code-builder","api","api-rest","llama3","mule","mule4","mulesoft","ollama","rest","rest-api","restful-api"],"latest_commit_sha":null,"homepage":"https://www.prostdev.com/post/mac-project-ollama-ai","language":"RAML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ProstDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-20T00:06:07.000Z","updated_at":"2024-12-04T19:00:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"e917345d-7509-4d47-b19b-5d6c137e980c","html_url":"https://github.com/ProstDev/mac-ollama-proj","commit_stats":null,"previous_names":["prostdev/mac-ollama-proj"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProstDev%2Fmac-ollama-proj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProstDev%2Fmac-ollama-proj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProstDev%2Fmac-ollama-proj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProstDev%2Fmac-ollama-proj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ProstDev","download_url":"https://codeload.github.com/ProstDev/mac-ollama-proj/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244868088,"owners_count":20523581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","anypoint-code-builder","api","api-rest","llama3","mule","mule4","mulesoft","ollama","rest","rest-api","restful-api"],"created_at":"2024-11-28T04:07:42.761Z","updated_at":"2025-03-21T20:44:22.026Z","avatar_url":"https://github.com/ProstDev.png","language":"RAML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MuleSoft AI Chain (MAC) + Ollama\n\nSimple Mule application making use of the [MAC](https://mac-project.ai/) (MuleSoft AI Chain) project to connect to [Ollama](https://ollama.com/) (`llama3` model).\n\nFull tutorial: [How to connect your local Ollama AI using the MAC project and ACB](https://www.prostdev.com/post/mac-project-ollama-ai)\n\n## Similar repos\n\n[![](https://github-readme-stats.vercel.app/api/pin/?username=alexandramartinez\u0026repo=mac-vectors-file-reader\u0026theme=graywhite)](https://github.com/alexandramartinez/mac-vectors-file-reader)\n[![](https://github-readme-stats.vercel.app/api/pin/?username=alexandramartinez\u0026repo=ollama-llm-provider\u0026theme=graywhite)](https://github.com/alexandramartinez/ollama-llm-provider)\n\n## Steps\n\n### 1 - Install Ollama locally\n\n- Go to [ollama.com](https://ollama.com/) and follow the prompts to install in your local computer\n- Make a note of which version you started running (like `llama3` or `llama3.2`)\n- To verify ollama is running, you should either be able to interact with it in the terminal or you should be able to run `ollama list` or `ollama ps`\n- We will verify the local installation in MuleSoft before deploying to CloudHub\n\n### 2 - Create the API specification\n\n- In ACB \u003e Design an API\n- Name it `MAC-Ollama-API`\n- REST API / RAML 1.0\n- Create project\n- Use the [mac-ollama-api.raml](/specification/mac-ollama-api.raml) file\n- Publish to Exchange\n\n### 3 - Implement the API\n\n- Select Yes to implement this API in ACB\n- Name it `mac-ollama-proj`, select the folder where you want to keep this, select Mule Runtime 4.8 and Java 17\n- Once the project finishes loading, open the `mac-ollama-proj.xml` file under `src/main/mule`\n- Take a look at the contents from [mac-ollama-proj.xml](/mule-project/src/main/mule/mac-ollama-proj.xml) to configure your own\n- Create a new file called `llm-config.json` under `src/main/resources` with the following:\n\n```json\n{\n    \"OLLAMA\": {\n        \"OLLAMA_BASE_URL\": \"http://localhost:11434\"\n    }\n}\n```\n\n- This will let us test Ollama locally first\n\n### 4 - Test the app locally\n\n- Run the app locally\n- Send a **POST** request to `localhost:8081/api/chat` with a JSON body including your question\n\n```shell\ncurl -H 'Content-Type: application/json' -X POST http://localhost:8081/api/chat -d '\"hello\"'\n```\n\n- If everything was successful, continue to the next step. Otherwise, please troubleshoot before continuing\n- Stop the app\n\n### 5 - Use ngrok for the public endpoint\n\n- Download and install [ngrok](https://download.ngrok.com/mac-os) to make your Ollama endpoint publicly available from the internet. This way, CloudHub will be able to access the URL since it's not only in your local (localhost:11434)\n- Run the following from your Termina/cmd:\n\n```shell\nngrok http 11434 --host-header=\"localhost:11434\"\n```\n\n- Copy the address from the **Forwarding** field\n- Paste it in your `llm-config.json` file under `src/main/resources`\n- Save the file and run the app again to verify everything still works correctly\n- Stop the app once you verify it works\n\n### 6 - Deploy to CloudHub\n\n- Go to your `pom.xml` file and change the version to `1.0.0` (remove the SNAPSHOT)\n- Save the file\n- Head to your `mac-ollama-proj.xml` file and click on the Deploy to CloudHub button\n- Select the options you want (you can leave the defaults) and deploy\n- Once the deployment is done, get the Public Endpoint from your application and call it to verify the app works\n\n```shell\ncurl -H 'Content-Type: application/json' -X POST https://mac-ollama-proj-ny7z.5sy6-1.usa-e2.cloudhub.io/api/chat -d '\"hello\"'\n```\n\n\u003e [!NOTE]\n\u003e If you experience a lot of issues with the deployment from ACB, you can also get the JAR from the `target` folder and deploy manually in Runtime Manager\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprostdev%2Fmac-ollama-proj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprostdev%2Fmac-ollama-proj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprostdev%2Fmac-ollama-proj/lists"}