Skip to content

Commit

Permalink
Add LLM agent concepts and PR descriptors (#793)
Browse files Browse the repository at this point in the history
* feat: ✨ add LLM agent concepts and PR descriptors

* feat(cli): ✨ add 'agent' keyword to package.json
  • Loading branch information
pelikhan authored Oct 23, 2024
1 parent 45e9054 commit 5cf8576
Show file tree
Hide file tree
Showing 7 changed files with 239 additions and 16 deletions.
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"genai",
"ai",
"agentic",
"agent",
"cli",
"prompt",
"llm",
Expand Down
45 changes: 45 additions & 0 deletions slides/pages/agents-concept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
layout: two-cols-header
---

# Agent Tool = nested LLM + Tools

- **Agent orchestration left to the LLM**
- Agent tool description augment with nested tool description (not id!)

::left::

```mermaid {scale: 0.8}
flowchart LR
query(["summarize changes in the current branch"]) --> LLM((LLM))
LLM --> |"get changes in current branch"| agent_git
agent_git --> |"diff +main.ts -main.ts...+ new code"| LLM
subgraph agent_git ["agent git"]
agent_git_LLM((LLM)) <--> git_tools["git branch, git diff"]
end
```

::right::

- definition

```js
defTool(
"agent_git",
"Agent that can query git",
{ query: { type: "string" } },
async ({ query }) =>
prompt`You are a git god. Answer ${query}.`.options({
tools: ["git_branch", "git_diff"],
})
)
```

- usage

```js
script({ tools: ["agent_git"]})
...
```
34 changes: 34 additions & 0 deletions slides/pages/agents-memory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
layout: two-cols-header
---

# Agent Memory

- Top level LLM "forgets" to give details \*\*\*
- Share findings with memory (LLM RAG log of agent query-answer pairs using SLM)

- store

```mermaid
flowchart LR
query(["summarize changes in the current branch"]) --> LLM((LLM))
LLM --> |"query the last failed run"| agent_github
agent_github["agent github"] --> |"commit failed_sha is responsible"| LLM
memory[(agent memory)]
agent_github --> |"remember failed_run, failed_sha"| memory
```

- retreive

```mermaid
flowchart LR
LLM((LLM))
memory[(agent memory)]
LLM --> |"get changes in current branch"| agent_git
agent_git["agent git"] --> |"diff +main.ts -main.ts...+ new code"| LLM
memory ---> |"failed_sha"| agent_git
```
25 changes: 25 additions & 0 deletions slides/pages/agents-multi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Multiple Agents

```mermaid
flowchart LR
query(["summarize changes in the current branch"]) --> LLM((LLM))
LLM --> |"get changes in current branch"| agent_git
agent_git["agent git (LLM, git diff, git branch)"] --> |"diff +main.ts -main.ts...+ new code"| LLM
LLM --> |"query the last failed run"| agent_github
agent_github["agent github (LLM, list workflow runs, list jobs, diff job logs)"] --> |"commit failed_sha is responsible"| LLM
```


```js
defAgent("git", "query git", "You are a git god.", {
tools: ["git_branch", "git_diff"],
})
```

```js
defAgent("github", "query github", "You are a github god.", {
tools: ["github_pulls", "github_job_log"],
})
```
63 changes: 63 additions & 0 deletions slides/pages/agents-prd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
layout: two-cols-header
---

# Pull Request Descriptor

Generate a pull request description from the current branch.

::left::


<v-click>

```js

$`Update the pull request description`
```

</v-click>

<v-click>

```js

$`for the changes`
```

</v-click>


<v-click>

```js
$`in the current branch`
```

</v-click>


::right::

#

#

<v-click at="1">

What is the current pull request?

</v-click>

<v-click at="2">

What are the current changes?

</v-click>

<v-click at="3">

What is the current branch?

</v-click>

28 changes: 12 additions & 16 deletions slides/pages/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
layout: two-cols-header
---

# Tools = JavaScript Function

- Tools are JavaScript functions
- Builtin "Agentic" framework
# Tool = JavaScript Function

::left::

Expand All @@ -24,23 +21,22 @@ stateDiagram

::right::

- definition

```js
defTool(
"fs_read_file",
"Reads a file as text from the file system.",
{
type: "object",
properties: {
filename: {
type: "string",
description: "Path of the file.",
},
},
required: ["filename"],
filename: { type: "string" },
},
async (args) => {
const { filename } = args
return await workspace.readText(filename)
}
async ({ filename }) => await workspace.readText(filename)
)
```

- usage

```js
script({ tools: ["fs_read_file"]})
...
```
59 changes: 59 additions & 0 deletions slides/slides-agents-oct2024.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
# try also 'default' to start simple
theme: default
title: GenAIScript
titleTemplate: '%s'
#colorSchema: dark
favicon: 'https://microsoft.github.io/genaiscript/images/favicon.svg'
info: |
## GenAIScript
Scripting for Generative AI.<br/>
[Docs](https://microsoft.github.io/genaiscript/) | [GitHub](https://github.com/microsoft/genaiscript/)
class: text-center
# https://sli.dev/custom/highlighters.html
highlighter: shiki
# https://sli.dev/guide/drawing
drawings:
persist: false
# slide transition: https://sli.dev/guide/animations#slide-transitions
#transition: slide-left
# enable MDC Syntax: https://sli.dev/guide/syntax#mdc-syntax
mdc: true
layout: center
---

![](https://microsoft.github.io/genaiscript/images/favicon.svg){ style="width: 12rem; margin:auto;" }

# GenAIScript

## LLM Agents

<br/>
<br/>

https://microsoft.github.io/genaiscript/


---
src: pages/script.md
---

---
src: pages/tools.md
---

---
src: pages/agents-concept.md
---

---
src: pages/agents-multi.md
---

---
src: pages/agents-memory.md
---

---
src: pages/agents-prd.md
---

0 comments on commit 5cf8576

Please sign in to comment.