Skip to content

Commit

Permalink
clean up docs (#150)
Browse files Browse the repository at this point in the history
Doesn't change any behavior just makes the docs a bit cleaner with
syntax highlighting and made some of the examples/wording clearer.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
C-Loftus and pre-commit-ci[bot] authored Aug 11, 2024
1 parent 108f144 commit 1c2e456
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 71 deletions.
6 changes: 1 addition & 5 deletions .docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ export default defineConfig({
sidebar: [
{
label: "Guides",
items: [
// Each item here is one entry in the navigation menu.
{ label: "Quickstart", slug: "guides/quickstart" },
{ label: "Customizing", slug: "guides/customizing" },
],
autogenerate: { directory: "guides" },
},
{
label: "Reference",
Expand Down
31 changes: 0 additions & 31 deletions .docs/components/FetchedData.astro

This file was deleted.

30 changes: 9 additions & 21 deletions .docs/src/components/FetchedData.astro
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
---
import Code from "astro/components/Code.astro";
import { Code } from '@astrojs/starlight/components';
//import Code from "astro/components/Code.astro"; Don't use this, use the starlight component specifically
const { data } = Astro.props; // Receive the data as a prop
const response = await fetch(data);
const fetchedData = await response.text();
// // Function to extract the basename from a URL
// const getBasename = (url: string | URL) => {
// const urlObj = new URL(url);
// return urlObj.pathname.split('/').filter(Boolean).pop() || 'Index';
// };
// Function to extract the basename from a URL
const getBasename = (url: string | URL) => {
const urlObj = new URL(url);
return urlObj.pathname.split('/').filter(Boolean).pop() || 'Index';
};
// const basename = getBasename(data);
const basename = getBasename(data);
---

<style>
.data-container pre {
white-space: pre-wrap; /* Allows wrapping of long lines */
word-wrap: break-word; /* Ensures long words break and wrap */
overflow-x: auto; /* Adds horizontal scrollbar if necessary */
}

.data-container a {
text-decoration: none; /* Removes underline from link */
color: #007bff; /* Link color */
}
</style>


<Code code={fetchedData} lang="yml" />
<Code code={fetchedData} lang="yml" title={basename}/>
10 changes: 6 additions & 4 deletions .docs/src/content/docs/guides/customizing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ You do not need to fork the repository to add your own custom prompts. Copy the

### Configuring Model Name

The model name is used to invoke the large language model. By default it is named 'model' and you can use 'model' when you invoke any commands. For example you can ask the model to do something for you by saying 'model ask \<text\>'. You can override this in your own configuration without changing this repository. To do so just create another talon list with the same name and a higher specificity. Here is an example that you can copy and past into your own configuration files
The word `model` is the default prefix before all LLM commands to prevent collisions with other Talon commands. However, you can change or override it. To do so just create another talon list with the same name and a higher specificity. Here is an example that you can copy and past into your own configuration files

```yml
```yml title="myCustomModelName.talon-list"
list: user.model
-

# The default model name
model: model
# Whatever you say that matches the value on the left will be mapped to the word `model`
# and thus allow any model commands to work as normal, but with a new prefix keyword

my custom model name: model
```
### Providing Custom User Context
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: Quickstart
description: Set up talon-ai-tools in under 5 min
sidebar:
order: 1
---

:::note
Expand All @@ -9,24 +11,30 @@ This assumes you have Talon installed. If you are new to Talon check out the Qui

:::

import { Steps } from "@astrojs/starlight/components";

<Steps>

1. Download or `git clone` this repo into your Talon user directory.
1. [Obtain an OpenAI API key](https://platform.openai.com/signup).

1. Create a Python file anywhere in your Talon user directory.
1. Set the key environment variable within the Python file

:::caution
:::caution

Make sure you do not push the key to a public repo!
Make sure you do not push the key to a public repo!

:::
:::

```python
# Example of setting the environment variable
import os

```python
# Example of setting the environment variable
import os
os.environ["OPENAI_API_KEY"] = "YOUR-KEY-HERE"
```

os.environ["OPENAI_API_KEY"] = "YOUR-KEY-HERE"
```
</Steps>

### Quickstart Video

Expand Down
6 changes: 4 additions & 2 deletions .docs/src/content/docs/reference/gpt.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
---
title: GPT Commands
description: Run
sidebar:
order: 1
---

import FetchedData from "../../../components/FetchedData.astro";

GPT commands make requests to an LLM endpoint. In talon each GPT command is prefixed with the word `model`. A model command has 4 parts
GPT commands make requests to an LLM endpoint. In our grammar, each GPT command is prefixed with the word `model`. A model command has 4 parts

- `model`
- A prompt name
Expand Down Expand Up @@ -34,7 +36,7 @@ There are also a few other special commands like `model please` and `model ask`

## All model options

_The left is the spoken word, and the right, is how talon interprets it_
_The left is the spoken word, and the right is how talon interprets it_

### Mappings of prompts to their spoken name

Expand Down

0 comments on commit 1c2e456

Please sign in to comment.