Skip to content

Commit

Permalink
🧼 prettier format
Browse files Browse the repository at this point in the history
  • Loading branch information
shroominic committed Jan 29, 2024
1 parent 82a5535 commit b67f691
Show file tree
Hide file tree
Showing 22 changed files with 643 additions and 579 deletions.
12 changes: 6 additions & 6 deletions docs/concepts/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ TODO: rewrite this

## Concepts Overview

| name | description |
|-|-|
| chain | Main funcchain to get responses from the assistant |
| achain | Async version of chain |
| settings | Global settings object |
| BaseModel | Pydantic model base class |
| name | description |
| --------- | -------------------------------------------------- |
| chain | Main funcchain to get responses from the assistant |
| achain | Async version of chain |
| settings | Global settings object |
| BaseModel | Pydantic model base class |

## chain

Expand Down
20 changes: 10 additions & 10 deletions docs/contributing/code-of-conduct.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Expand Down
6 changes: 3 additions & 3 deletions docs/contributing/contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

We would like to acknowledge the contributions of the following people:

Name | Contribution |
------|--------------|
| |
| Name | Contribution |
| ---- | ------------ |
| |

## How to Contribute

Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/roadmap.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TODOs for writing the documentation

- [ ] write out all scratched docs .md files
- [ ] write out all scratched docs .md files

- [ ] look into other repos for mkdocs inspiration

Expand Down
51 changes: 28 additions & 23 deletions docs/css/custom.css
Original file line number Diff line number Diff line change
@@ -1,47 +1,52 @@
.termynal-comment {
color: #4a968f;
font-style: italic;
display: block;
color: #4a968f;
font-style: italic;
display: block;
}

.termy [data-termynal] {
white-space: pre-wrap;
white-space: pre-wrap;
}

a.external-link::after {
/* \00A0 is a non-breaking space
/* \00A0 is a non-breaking space
to make the mark be on the same line as the link
*/
content: "\00A0[↪]";
content: "\00A0[↪]";
}

a.internal-link::after {
/* \00A0 is a non-breaking space
/* \00A0 is a non-breaking space
to make the mark be on the same line as the link
*/
content: "\00A0↪";
content: "\00A0↪";
}

.shadow {
box-shadow: 5px 5px 10px #999;
box-shadow: 5px 5px 10px #999;
}

pre {
position: relative;
position: relative;
}

.copy-code-button {
position: absolute;
right: 5px;
top: 5px;
cursor: pointer;
padding: 0.5em;
margin-bottom: 0.5em;
background-color: rgba(247, 247, 247, 0.4); /* Light grey background with slight transparency */
border: 1px solid #dcdcdc; /* Slightly darker border for definition */
border-radius: 3px; /* Rounded corners */
font-family: monospace; /* Monospace font similar to code blocks */
font-size: 0.85em; /* Slightly smaller font size */
color: #333; /* Dark grey text for contrast */
outline: none; /* Remove outline to maintain minimal style on focus */
position: absolute;
right: 5px;
top: 5px;
cursor: pointer;
padding: 0.5em;
margin-bottom: 0.5em;
background-color: rgba(
247,
247,
247,
0.4
); /* Light grey background with slight transparency */
border: 1px solid #dcdcdc; /* Slightly darker border for definition */
border-radius: 3px; /* Rounded corners */
font-family: monospace; /* Monospace font similar to code blocks */
font-size: 0.85em; /* Slightly smaller font size */
color: #333; /* Dark grey text for contrast */
outline: none; /* Remove outline to maintain minimal style on focus */
}
126 changes: 65 additions & 61 deletions docs/css/termynal.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,104 +6,108 @@
* @license MIT
*/

:root {
--color-bg: #252a33;
--color-text: #eee;
--color-text-subtle: #a2a2a2;
:root {
--color-bg: #252a33;
--color-text: #eee;
--color-text-subtle: #a2a2a2;
}

[data-termynal] {
width: 750px;
max-width: 100%;
background: var(--color-bg);
color: var(--color-text);
/* font-size: 18px; */
font-size: 15px;
/* font-family: 'Fira Mono', Consolas, Menlo, Monaco, 'Courier New', Courier, monospace; */
font-family: 'Roboto Mono', 'Fira Mono', Consolas, Menlo, Monaco, 'Courier New', Courier, monospace;
border-radius: 4px;
padding: 75px 45px 35px;
position: relative;
-webkit-box-sizing: border-box;
box-sizing: border-box;
width: 750px;
max-width: 100%;
background: var(--color-bg);
color: var(--color-text);
/* font-size: 18px; */
font-size: 15px;
/* font-family: 'Fira Mono', Consolas, Menlo, Monaco, 'Courier New', Courier, monospace; */
font-family: "Roboto Mono", "Fira Mono", Consolas, Menlo, Monaco,
"Courier New", Courier, monospace;
border-radius: 4px;
padding: 75px 45px 35px;
position: relative;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}

[data-termynal]:before {
content: '';
position: absolute;
top: 15px;
left: 15px;
display: inline-block;
width: 15px;
height: 15px;
border-radius: 50%;
/* A little hack to display the window buttons in one pseudo element. */
background: #d9515d;
-webkit-box-shadow: 25px 0 0 #f4c025, 50px 0 0 #3ec930;
box-shadow: 25px 0 0 #f4c025, 50px 0 0 #3ec930;
content: "";
position: absolute;
top: 15px;
left: 15px;
display: inline-block;
width: 15px;
height: 15px;
border-radius: 50%;
/* A little hack to display the window buttons in one pseudo element. */
background: #d9515d;
-webkit-box-shadow:
25px 0 0 #f4c025,
50px 0 0 #3ec930;
box-shadow:
25px 0 0 #f4c025,
50px 0 0 #3ec930;
}

[data-termynal]:after {
content: 'bash';
position: absolute;
color: var(--color-text-subtle);
top: 5px;
left: 0;
width: 100%;
text-align: center;
content: "bash";
position: absolute;
color: var(--color-text-subtle);
top: 5px;
left: 0;
width: 100%;
text-align: center;
}

a[data-terminal-control] {
text-align: right;
display: block;
color: #aebbff;
text-align: right;
display: block;
color: #aebbff;
}

[data-ty] {
display: block;
line-height: 2;
display: block;
line-height: 2;
}

[data-ty]:before {
/* Set up defaults and ensure empty lines are displayed. */
content: '';
display: inline-block;
vertical-align: middle;
/* Set up defaults and ensure empty lines are displayed. */
content: "";
display: inline-block;
vertical-align: middle;
}

[data-ty="input"]:before,
[data-ty-prompt]:before {
margin-right: 0.75em;
color: var(--color-text-subtle);
margin-right: 0.75em;
color: var(--color-text-subtle);
}

[data-ty="input"]:before {
content: '$';
content: "$";
}

[data-ty][data-ty-prompt]:before {
content: attr(data-ty-prompt);
content: attr(data-ty-prompt);
}

[data-ty-cursor]:after {
content: attr(data-ty-cursor);
font-family: monospace;
margin-left: 0.5em;
-webkit-animation: blink 1s infinite;
animation: blink 1s infinite;
content: attr(data-ty-cursor);
font-family: monospace;
margin-left: 0.5em;
-webkit-animation: blink 1s infinite;
animation: blink 1s infinite;
}


/* Cursor animation */

@-webkit-keyframes blink {
50% {
opacity: 0;
}
50% {
opacity: 0;
}
}

@keyframes blink {
50% {
opacity: 0;
}
50% {
opacity: 0;
}
}
13 changes: 6 additions & 7 deletions docs/features/chat.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
## Simple chatgpt rebuild with memory/history
# ChatGPT rebuild with memory/history

!!! Example
chatgpt.py [Example](https://github.com/shroominic/funcchain/blob/main/examples/chatgpt.py)

!!! Important
Ensure you have set up your API key for the LLM of your choice, or Funcchain will look for a `.env` file. So in `.env` set up your key.

```bash
OPENAI_API_KEY="sk-rnUBxirFQ4bmz2Ae4qyaiLShdCJcsOsTg"
```
```bash
OPENAI_API_KEY="sk-rnUBxirFQ4bmz2Ae4qyaiLShdCJcsOsTg"
```

## Code Example

<pre><code id="codeblock">
```python
from funcchain import chain, settings
Expand All @@ -21,15 +22,13 @@ settings.console_stream = True

history = ChatMessageHistory()


def ask(question: str) -> str:
return chain(
system="You are an advanced AI Assistant.",
instruction=question,
memory=history,
)


def chat_loop() -> None:
while True:
query = input("> ")
Expand All @@ -45,7 +44,6 @@ def chat_loop() -> None:

ask(query)


if __name__ == "__main__":
print("Hey! How can I help you?\n")
chat_loop()
Expand All @@ -64,6 +62,7 @@ if __name__ == "__main__":
assistant terminal asnwer:
$ Funcchain is cool.
```

</div>

## Instructions
Expand Down
1 change: 1 addition & 0 deletions docs/features/dynamic_router.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ router.invoke_route("Can you summarize this csv?")
```

Demo

<div class="termy">
```python
User:
Expand Down
Loading

0 comments on commit b67f691

Please sign in to comment.