-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5222c0
commit 3d5d9c8
Showing
108 changed files
with
448 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.3">Jekyll</generator><link href="https://michaelcurrin.github.io/code-cookbook/feed.xml" rel="self" type="application/atom+xml" /><link href="https://michaelcurrin.github.io/code-cookbook/" rel="alternate" type="text/html" /><updated>2024-07-31T13:54:28+00:00</updated><id>https://michaelcurrin.github.io/code-cookbook/feed.xml</id><title type="html">Code Cookbook</title><subtitle>Reusable code patterns which you can use as reference or copy to your project</subtitle><author><name>Michael Currin</name></author></feed> | ||
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.3">Jekyll</generator><link href="https://michaelcurrin.github.io/code-cookbook/feed.xml" rel="self" type="application/atom+xml" /><link href="https://michaelcurrin.github.io/code-cookbook/" rel="alternate" type="text/html" /><updated>2024-07-31T14:10:34+00:00</updated><id>https://michaelcurrin.github.io/code-cookbook/feed.xml</id><title type="html">Code Cookbook</title><subtitle>Reusable code patterns which you can use as reference or copy to your project</subtitle><author><name>Michael Currin</name></author></feed> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -545,6 +545,7 @@ <h2>Topics</h2> | |
|
||
|
||
|
||
|
||
|
||
|
||
</div> | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -546,6 +546,7 @@ <h2>Topics</h2> | |
|
||
|
||
|
||
|
||
|
||
|
||
</div> | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,268 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
|
||
|
||
<meta property="og:site_name" content="Code Cookbook" /> | ||
|
||
<title>LLM | Code Cookbook</title> | ||
|
||
<meta property="og:title" content="LLM" /> | ||
|
||
<meta name="twitter:card" content="summary" /> | ||
<meta property="twitter:title" content="LLM" /> | ||
<meta name="generator" content="Jekyll v4.3.3" /> | ||
|
||
<meta property="og:locale" content="en_US" /> | ||
|
||
|
||
<meta name="description" content="Reusable code patterns which you can use as reference or copy to your project" /> | ||
<meta property="og:description" content="Reusable code patterns which you can use as reference or copy to your project" /> | ||
<meta name="author" content="Michael Currin" /> | ||
|
||
|
||
|
||
<link rel="canonical" href="https://michaelcurrin.github.io/code-cookbook/recipes/artificial-intelligence/llm.html" /> | ||
<meta property="og:url" content="https://michaelcurrin.github.io/code-cookbook/recipes/artificial-intelligence/llm.html" /> | ||
|
||
|
||
<script type="application/ld+json"> | ||
{ | ||
"name": "Code Cookbook", | ||
"description": "Reusable code patterns which you can use as reference or copy to your project", | ||
"url": "https://michaelcurrin.github.io/code-cookbook/recipes/artificial-intelligence/llm.html", | ||
"headline": "LLM", | ||
"@type": "WebSite", | ||
"@context": "https://schema.org", | ||
"author": { | ||
"@type":"Person", | ||
"name": "Michael Currin" | ||
} | ||
} | ||
</script> | ||
<link rel="stylesheet" href="/code-cookbook/assets/main.css"><link type="application/atom+xml" rel="alternate" href="https://michaelcurrin.github.io/code-cookbook/feed.xml" title="Code Cookbook" /><script async src="https://www.googletagmanager.com/gtag/js?id=G-ED9PSVN5DS"></script> | ||
<script> | ||
window['ga-disable-G-ED9PSVN5DS'] = window.doNotTrack === "1" || navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || navigator.msDoNotTrack === "1"; | ||
window.dataLayer = window.dataLayer || []; | ||
|
||
function gtag() { dataLayer.push(arguments); } | ||
gtag('js', new Date()); | ||
|
||
gtag('config', 'G-ED9PSVN5DS'); | ||
</script></head> | ||
<body> | ||
<header class="site-header" role="banner"> | ||
|
||
<div class="wrapper"><a class="site-title" rel="author" href="/code-cookbook/"> | ||
Code Cookbook | ||
</a><nav class="site-nav"> | ||
<input type="checkbox" id="nav-trigger" class="nav-trigger" /> | ||
|
||
<label for="nav-trigger"> | ||
<span class="menu-icon"> | ||
<svg viewBox="0 0 18 15" width="18px" height="15px"> | ||
<path | ||
d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.032C17.335,0,18,0.665,18,1.484L18,1.484z M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.032C17.335,6.031,18,6.696,18,7.516L18,7.516z M18,13.516C18,14.335,17.335,15,16.516,15H1.484 C0.665,15,0,14.335,0,13.516l0,0c0-0.82,0.665-1.483,1.484-1.483h15.032C17.335,12.031,18,12.695,18,13.516L18,13.516z" /> | ||
</svg> | ||
</span> | ||
</label> | ||
|
||
<div class="trigger"><a class="page-link" href="/code-cookbook/"> | ||
Home | ||
</a><a class="page-link" href="/code-cookbook/recipes/"> | ||
Recipes | ||
</a><a class="page-link" href="/code-cookbook/about.html"> | ||
About | ||
</a><a class="ext-link page-link" href="https://michaelcurrin.github.io/dev-cheatsheets/"> | ||
<span>Dev Cheatsheets</span> | ||
<img src="/code-cookbook/assets/ext-link.svg" /> | ||
</a><a class="ext-link page-link" href="https://michaelcurrin.github.io/dev-resources/"> | ||
<span>Dev Resources</span> | ||
<img src="/code-cookbook/assets/ext-link.svg" /> | ||
</a></div> | ||
</nav></div> | ||
</header> | ||
<main class="page-content" aria-label="Content"> | ||
<div class="wrapper"> | ||
<a id="github-edit" href="https://github.com/MichaelCurrin/code-cookbook/edit/master/recipes/artificial-intelligence/llm.md"> | ||
π <span>Edit page</span> | ||
</a> | ||
|
||
<a id="github-add" href="https://github.com/MichaelCurrin/code-cookbook/new/master/recipes/artificial-intelligence/"> | ||
β <span>Add page</span> | ||
</a> | ||
|
||
|
||
|
||
|
||
<article class="post"> | ||
<header class="post-header"> | ||
<h1 class="post-title"> | ||
|
||
|
||
|
||
<span>LLM</span> | ||
</h1> | ||
|
||
|
||
</header> | ||
|
||
|
||
|
||
|
||
<div id="breadcrumbs"> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<a href="/code-cookbook/recipes/"> | ||
Recipes | ||
</a> | ||
|
||
|
||
|
||
|
||
/ | ||
|
||
|
||
|
||
|
||
<a href="/code-cookbook/recipes/artificial-intelligence/"> | ||
Artificial Intelligence | ||
</a> | ||
|
||
|
||
|
||
|
||
/ | ||
|
||
|
||
|
||
<a href="/code-cookbook/recipes/artificial-intelligence/llm.html" class="underline"> | ||
LLM | ||
</a> | ||
|
||
|
||
</div> | ||
|
||
|
||
|
||
<br> | ||
|
||
<div class="post-content"> | ||
|
||
<h2 id="code">Code</h2> | ||
|
||
<p>System prompt:</p> | ||
|
||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Follow Clean Code best practices: | ||
Meaningful names: Use clear, descriptive names for variables, functions, and classes. | ||
Small functions: Keep functions short and focused on a single task. | ||
DRY (Don't Repeat Yourself): Avoid code duplication. | ||
SOLID principles: Follow Object-Oriented Design principles. | ||
Comments: Write self-explanatory code, use comments sparingly. Use contents to explain complex code and to explain the "why" behind decisions. | ||
Error handling: Handle exceptions gracefully, avoid returning null. | ||
Simple design: Keep classes and methods simple and cohesive. | ||
|
||
Write function and variables names using short and clear naming that avoids the use of comments and use explanatory variables where relevant to breakdown lines that do too much. | ||
|
||
Always add docstrings. | ||
|
||
For Bash, keep docstrings to one line. | ||
|
||
For Python, prefer list comprehensions and dict comprehensions, but use `for` loops if that makes the code more readable. | ||
|
||
For Python, write Python docstrings using Google style format e.g. | ||
""" | ||
Return the sum of abc and def. | ||
|
||
:param abc: Description. | ||
:param def: Description. | ||
|
||
:return xyz: Description. | ||
""" | ||
|
||
For Python, write one-line docstrings on 3 lines. e.g. | ||
""" | ||
Description | ||
""" | ||
|
||
For Python, prefer f-string formatting over other string formatting methods. | ||
|
||
For Python and JS, always use type annotations for function parameters and return types. Create custom types for complex structures, especially for lists and dicts. | ||
|
||
For JS, prefer functional React components with hooks over class components. | ||
For JS, use async-await syntax. | ||
For JS, use function declarations for named functions. Use arrow functions for callbacks and short, anonymous functions. | ||
For JS, write JSDoc docstrings. e.g. | ||
/** | ||
* Return the sum of abc and def. | ||
* | ||
* @param abc Description. | ||
* @param def Description. | ||
* | ||
* @returns xyz Description. | ||
*/ | ||
|
||
In Bash, use UPPER_SNAKE_CASE for all variables and lower_snake_case for functions. | ||
|
||
For Markdown: | ||
Create lists using a dash instead of an asterisk. | ||
Style bold text as `**bold**`. | ||
Style italic text as `_italics_`. | ||
</code></pre></div></div> | ||
|
||
|
||
</div> | ||
</article> | ||
|
||
</div> | ||
</main> | ||
<footer class="site-footer h-card"> | ||
<data class="u-url" href="/code-cookbook/"></data> | ||
|
||
<div class="wrapper"> | ||
|
||
<h2 class="footer-heading">Code Cookbook</h2> | ||
|
||
<div class="footer-col-wrapper"> | ||
<div class="footer-col footer-col-1"> | ||
<ul class="contact-list"><li class="p-name"> | ||
Michael Currin | ||
</li></ul> | ||
</div> | ||
|
||
<div class="footer-col footer-col-2"> | ||
<ul class="social-media-list"><li> | ||
<a href="https://github.com/MichaelCurrin"><svg | ||
class="svg-icon"> | ||
<use xlink:href="/code-cookbook/assets/fractal-social-icons.svg#github"> | ||
</use> | ||
</svg> <span class="username">MichaelCurrin</span></a> | ||
</li></ul> | ||
</div> | ||
|
||
<div class="footer-col footer-col-3"> | ||
<p>Reusable code patterns which you can use as reference or copy to your project</p> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
</footer> | ||
<a href="https://github.com/MichaelCurrin/code-cookbook" | ||
class="github-corner" aria-label="View source on GitHub"> | ||
<svg width="80" height="80" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path> | ||
</svg> | ||
</a> | ||
<style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style> | ||
|
||
</body> | ||
|
||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# LLM | ||
|
||
## Code | ||
|
||
System prompt: | ||
|
||
``` | ||
Follow Clean Code best practices: | ||
Meaningful names: Use clear, descriptive names for variables, functions, and classes. | ||
Small functions: Keep functions short and focused on a single task. | ||
DRY (Don't Repeat Yourself): Avoid code duplication. | ||
SOLID principles: Follow Object-Oriented Design principles. | ||
Comments: Write self-explanatory code, use comments sparingly. Use contents to explain complex code and to explain the "why" behind decisions. | ||
Error handling: Handle exceptions gracefully, avoid returning null. | ||
Simple design: Keep classes and methods simple and cohesive. | ||
Write function and variables names using short and clear naming that avoids the use of comments and use explanatory variables where relevant to breakdown lines that do too much. | ||
Always add docstrings. | ||
For Bash, keep docstrings to one line. | ||
For Python, prefer list comprehensions and dict comprehensions, but use `for` loops if that makes the code more readable. | ||
For Python, write Python docstrings using Google style format e.g. | ||
""" | ||
Return the sum of abc and def. | ||
:param abc: Description. | ||
:param def: Description. | ||
:return xyz: Description. | ||
""" | ||
For Python, write one-line docstrings on 3 lines. e.g. | ||
""" | ||
Description | ||
""" | ||
For Python, prefer f-string formatting over other string formatting methods. | ||
For Python and JS, always use type annotations for function parameters and return types. Create custom types for complex structures, especially for lists and dicts. | ||
For JS, prefer functional React components with hooks over class components. | ||
For JS, use async-await syntax. | ||
For JS, use function declarations for named functions. Use arrow functions for callbacks and short, anonymous functions. | ||
For JS, write JSDoc docstrings. e.g. | ||
/** | ||
* Return the sum of abc and def. | ||
* | ||
* @param abc Description. | ||
* @param def Description. | ||
* | ||
* @returns xyz Description. | ||
*/ | ||
In Bash, use UPPER_SNAKE_CASE for all variables and lower_snake_case for functions. | ||
For Markdown: | ||
Create lists using a dash instead of an asterisk. | ||
Style bold text as `**bold**`. | ||
Style italic text as `_italics_`. | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -557,6 +557,7 @@ <h2>Topics</h2> | |
|
||
|
||
|
||
|
||
|
||
|
||
</div> | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -558,6 +558,7 @@ <h2>Topics</h2> | |
|
||
|
||
|
||
|
||
|
||
|
||
</div> | ||
|
Oops, something went wrong.