This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Setting up a local LLM with Ollama" | |
author: "Nafeu Nasir" | |
description: "Getting up and running with Ollama and integrating it into your workflow." | |
date: 2024-01-24 | |
--- | |
# What is a local large language model? (LLM) | |
You've heard of LLMs, you've heard of ChatGPT, or Bard or Grok. Well a local LLM is one you can run on your computer. This means that you don't need to rely on a cloud service to use them (better data privacy and security). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const JSONBIN_BIN_ID = '...'; | |
const JSONBIN_URL = `https://api.jsonbin.io/v3/b/${JSONBIN_BIN_ID}`; | |
const JSONBIN_MASTER_KEY = '...'; | |
const JSONBIN_ACCESS_KEY = '...'; | |
function fetchData({ onSuccess, onFail }) { | |
const url = JSONBIN_URL; | |
const headers = new Headers(); | |
headers.append('X-Master-Key', JSONBIN_MASTER_KEY); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Usage: | |
1. Make sure you have node installed on your machine (https://github.com/Schniz/fnm) | |
2. Run `npm install --global moment-timezone` | |
3. Replace ROOT_TIMEZONE with your local timezone | |
ie. const ROOT_TIMEZONE = 'America/Toronto' | |
4. Use `node timezone-message.js [MESSAGE] [TIME] [AM/PM]` | |
ie. `node timezone-message.js 'next pomodoro starting at:' 3:00 PM` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{headerGroups.map(headerGroup => ( | |
<tr {...headerGroup.getHeaderGroupProps()}> | |
{headerGroup.headers.map(column => ( | |
<th {...column.getHeaderProps(column.getSortByToggleProps())}> | |
{column.render('Header')} | |
<span> | |
{column.isSorted | |
? column.isSortedDesc | |
? ' ⬇️' | |
: ' ⬆️' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TableLayout = ({ | |
getTableProps, | |
getTableBodyProps, | |
headerGroups, | |
rows, | |
prepareRow, | |
state: { globalFilter }, | |
visibleColumns, | |
preGlobalFilteredRows, | |
setGlobalFilter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TWO_HUNDRED_MS = 200; | |
function GlobalFilter({ | |
preGlobalFilteredRows, | |
globalFilter, | |
setGlobalFilter, | |
}) { | |
const [value, setValue] = useState(globalFilter); | |
const onChange = useAsyncDebounce(value => { | |
setGlobalFilter(value || undefined) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
Header: () => null, | |
id: 'expander', | |
Cell: ({ row, isLoading, isExpanded }) => { | |
const toggleRowExpandedProps = row.getToggleRowExpandedProps(); | |
const onClick = async event => { | |
if (!isLoading) { | |
if (!isExpanded) { | |
await onClickRow(row); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const [isRowLoading, setIsRowLoading] = useState({}); | |
const handleClickRow = async ({ id }) => { | |
setIsRowLoading({ [id]: true }); | |
const { data: childData } = await fetchChildData(); | |
setIsRowLoading({ [id]: false }) | |
if (tableData) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return existingRows.map((row, index) => { | |
const isMatchedRowWithSubRows = index === Number(id) && row.subRows; | |
if (isMatchedRowWithSubRows) { | |
const [, ...updatedPath] = path; | |
return { | |
...row, | |
subRows: insertIntoTable({ | |
existingRows: row.subRows, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isBaseCase = path.length === 1; | |
if (isBaseCase) { | |
return existingRows.map((row, index) => { | |
const isMatchedRowWithoutSubRows = index === Number(id) && !row.subRows; | |
if (isMatchedRowWithoutSubRows) { | |
return { | |
...row, | |
subRows: subRowsToInsert |
NewerOlder