Skip to content

Commit

Permalink
feat: updated demo to remove sql tool and link to new repo
Browse files Browse the repository at this point in the history
  • Loading branch information
drivian committed Jun 10, 2024
1 parent a4266c1 commit 995e8a1
Show file tree
Hide file tree
Showing 12 changed files with 92 additions and 73 deletions.
11 changes: 6 additions & 5 deletions backend/app/app/api/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
from app.api.v1.endpoints import chat, sql, statistics

api_router = APIRouter()
api_router.include_router(
sql.router,
prefix="/sql",
tags=["sql"],
)
# Uncomment SQL router to enable SQL tool
# api_router.include_router(
# sql.router,
# prefix="/sql",
# tags=["sql"],
# )
api_router.include_router(
chat.router,
prefix="/chat",
Expand Down
44 changes: 22 additions & 22 deletions backend/app/app/config/agent.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
tools_library: !include tools.yml
common: # settings shared by agent and all tools (can be overwritten by passing explicitly to constructors)
llm: 'gpt-4'
fast_llm: 'gpt-3.5-turbo'
fast_llm_token_limit: 2500
max_token_length: 4000
llm: 'gpt-4o'
fast_llm: 'gpt-4o'
fast_llm_token_limit: 5000
max_token_length: 6000
tools:
- expert_tool
- clarify_tool
Expand Down Expand Up @@ -37,24 +37,24 @@ action_plans:
actions:
- - memory
- clarify_tool
'2':
name: ''
description: |-
Use this plan to fetch Github-related information from the repository of AgentKit, such as commits, issues, pull requests.
Always use this action plan when asked about issues, pull requests, or commits - unless there is a specific request to make a visualization.
actions:
- - memory
- sql_tool
- - sql_expert_tool
'3':
name: ''
description: |-
Make a visualization regarding GitHub information of AgentKit, such as PRs, issues, or commits.
**ONLY use this action plan if there is a specific request to make a visualization**
actions:
- - memory
- sql_tool
- - visualizer_tool
# '2':
# name: ''
# description: |-
# Use this plan to fetch Github-related information from the repository of AgentKit, such as commits, issues, pull requests.
# Always use this action plan when asked about issues, pull requests, or commits - unless there is a specific request to make a visualization.
# actions:
# - - memory
# - sql_tool
# - - sql_expert_tool
# '3':
# name: ''
# description: |-
# Make a visualization regarding GitHub information of AgentKit, such as PRs, issues, or commits.
# **ONLY use this action plan if there is a specific request to make a visualization**
# actions:
# - - memory
# - sql_tool
# - - visualizer_tool
'4':
name: ''
description: |-
Expand Down
24 changes: 12 additions & 12 deletions backend/app/app/config/tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ library:
content: |-
The prompt for generating an image of the item is ...
clarify_tool:
default_llm: "gpt-4"
default_fast_llm: "gpt-3.5-turbo-1106"
default_llm: "gpt-4o"
default_fast_llm: "gpt-3.5-turbo"
description: >-
Tool to engage the user for additional input when the initial question lacks enough detail to determine the appropriate action plan.
Utilize this tool to solicit clarifications from the user, enabling a more informed action plan selection within the AgentKit codebase environment.
Expand Down Expand Up @@ -189,8 +189,8 @@ library:
max_rows_in_output: 30

expert_tool:
default_llm: "gpt-4"
default_fast_llm: "gpt-3.5-turbo-1106"
default_llm: "gpt-4o"
default_fast_llm: "gpt-3.5-turbo"
description: >-
Tool to answer the user question based on the documents retrieved by the pdf_tool. It analyzes the documents to provide reliable, helpful answers to specific technical queries related to the codebase, such as setup procedures or tool additions.
{examples}
Expand Down Expand Up @@ -230,7 +230,7 @@ library:
max_token_length: 8000

sql_expert_tool:
default_llm: "gpt-4"
default_llm: "gpt-4o"
default_fast_llm: "gpt-3.5-turbo"
description: >-
Tool to answer the user question based on the structured data retrieved by the sql_tool. This data has been retrieved
Expand Down Expand Up @@ -433,8 +433,8 @@ library:
prompt_message: ""

code_expert_tool:
default_llm: "gpt-4"
default_fast_llm: "gpt-3.5-turbo-1106"
default_llm: "gpt-4o"
default_fast_llm: "gpt-3.5-turbo"
description: >-
Tool to answer the user question based on the python source code and codebase documentation.
It analyzes the context to provide reliable, helpful answers to specific technical queries related to the codebase, such as setup procedures or tool additions.
Expand Down Expand Up @@ -576,7 +576,7 @@ library:
fast_llm_token_threshold: 7800

generate_config_tool:
default_llm: "gpt-4"
default_llm: "gpt-4o"
default_fast_llm: "gpt-3.5-turbo"
description: >-
Generation of a new parameter configuration as input into a optimization problem.
Expand Down Expand Up @@ -632,7 +632,7 @@ library:
- Software_Engineer: Number of resources available for Software_Engineer speciality
generate_optim_input_tool:
default_llm: "gpt-4"
default_llm: "gpt-4o"
default_fast_llm: "gpt-3.5-turbo"
description: >-
Generation of a new configuration as input into a optimization problem.
Expand Down Expand Up @@ -724,7 +724,7 @@ library:
- resource_req is the number of resources required for the feature (standard 1)
run_optimizer_tool:
default_llm: "gpt-4"
default_llm: "gpt-4o"
default_fast_llm: "gpt-3.5-turbo"
description: >-
Execution of the product development backlog optimization algorithm.
Expand All @@ -737,7 +737,7 @@ library:
placeholder
summarize_config_changes_tool:
default_llm: "gpt-4"
default_llm: "gpt-4o"
default_fast_llm: "gpt-3.5-turbo"
description: >-
Summarizes the changes between two parameter configuration.
Expand Down Expand Up @@ -825,7 +825,7 @@ library:
- New feature 'Introduce_New_Tool' was added with the following parameters: 'Data_Scientist' and 'Software_Engineer'
summarize_kpi_tool:
default_llm: "gpt-4"
default_llm: "gpt-4o"
default_fast_llm: "gpt-3.5-turbo"
description: >-
Optimizer output summarization.
Expand Down
1 change: 1 addition & 0 deletions backend/app/app/schemas/tool_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

LLMType = Literal[
"gpt-4",
"gpt-4o",
"gpt-3.5-turbo",
"azure-4-32k",
"azure-3.5",
Expand Down
8 changes: 8 additions & 0 deletions backend/app/app/services/chat_agent/helpers/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ def get_llm(
openai_api_key=api_key if api_key is not None else settings.OPENAI_API_KEY,
streaming=True,
)
case "gpt-4o":
return ChatOpenAI(
temperature=0,
model_name="gpt-4o",
openai_organization=settings.OPENAI_ORGANIZATION,
openai_api_key=api_key if api_key is not None else settings.OPENAI_API_KEY,
streaming=True,
)
# If an exact match is not confirmed, this last case will be used if provided
case _:
logger.warning(f"LLM {llm} not found, using default LLM")
Expand Down
1 change: 1 addition & 0 deletions caddy/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
reverse_proxy nextjs_server:3000
reverse_proxy /api/v1/* fastapi_server:9090
reverse_proxy /docs/* docusaurus:3001
reverse_proxy /docs docusaurus:3001
}

fastapi.{$EXT_ENDPOINT1}:80, fastapi.{$LOCAL_1}:80, fastapi.{$LOCAL_2}:80 {
Expand Down
44 changes: 22 additions & 22 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
container_name: fastapi_server
build: ./backend
restart: always
command: "sh -c 'alembic upgrade head && python app/document_ingestion.py && uvicorn app.main:app --reload --workers 1 --host 0.0.0.0 --port 9090'"
command: "sh -c 'alembic upgrade head && python app/document_ingestion.py && uvicorn app.main:app --reload --workers 5 --host 0.0.0.0 --port 9090'"
volumes:
- ./backend/app:/code
expose:
Expand Down Expand Up @@ -48,27 +48,27 @@ services:
- POSTGRES_DATABASE=${DATABASE_NAME}
- POSTGRES_HOST_AUTH_METHOD= "trust"

db_sql_tool: # Remove if not using sql tool
image: postgres:11
restart: always
container_name: db_sql_tool
volumes:
- ./db_docker:/var/lib/postgresql
- ./scripts/db_sql_tool/github_data_psql_load.sql:/docker-entrypoint-initdb.d/github_data_psql_load.sql
- ./backend/app/app/tool_constants/public_demo_data/pull_requests.csv:/docker-entrypoint-initdb.d/pull_requests.csv
- ./backend/app/app/tool_constants/public_demo_data/commit_history.csv:/docker-entrypoint-initdb.d/commit_history.csv
- ./backend/app/app/tool_constants/public_demo_data/issues.csv:/docker-entrypoint-initdb.d/issues.csv
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=sqltool
ports:
- "5632:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 15s
retries: 5
# db_sql_tool: # Remove if not using sql tool
# image: postgres:11
# restart: always
# container_name: db_sql_tool
# volumes:
# - ./db_docker:/var/lib/postgresql
# - ./scripts/db_sql_tool/github_data_psql_load.sql:/docker-entrypoint-initdb.d/github_data_psql_load.sql
# - ./backend/app/app/tool_constants/public_demo_data/pull_requests.csv:/docker-entrypoint-initdb.d/pull_requests.csv
# - ./backend/app/app/tool_constants/public_demo_data/commit_history.csv:/docker-entrypoint-initdb.d/commit_history.csv
# - ./backend/app/app/tool_constants/public_demo_data/issues.csv:/docker-entrypoint-initdb.d/issues.csv
# environment:
# - POSTGRES_USER=postgres
# - POSTGRES_PASSWORD=postgres
# - POSTGRES_DB=sqltool
# ports:
# - "5632:5432"
# healthcheck:
# test: ["CMD-SHELL", "pg_isready -U postgres"]
# interval: 10s
# timeout: 15s
# retries: 5

redis_server:
image: redis:alpine
Expand Down
4 changes: 1 addition & 3 deletions docs/docusaurus/docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ Key advantages of AgentKit include:
- 💻 **Flexible, reactive UI/UX designed for Agents**: React/Nextjs chat-based UI that is easy to configure, with features such as streaming, rendering of tables/visualizations/code, status of Agent actions and more
- 🛡️ **Focus on reliability**: Easy to configure routing architecture gives control of possible paths Agent can take, increasing reliability and making it suited for real-life use cases

As an example, try the AgentKit codebase helper [demo](https://agentkit.infra.x.bcg.com/)
<!-- TODO: add video -->

As an example, try the AgentKit codebase helper [demo](https://agentkit.infra.x.bcg.com/) build following the [tutorial](docs/tutorial/tutorial.md)

## Chinook music database demo
For a quick start to test some of the functionality, you can use the dummy Chinook example:
Expand Down
5 changes: 5 additions & 0 deletions docs/docusaurus/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ const sidebars = {
label: 'Configuration',
items: ['configuration/configure_agent_and_tools', 'configuration/configure_ui'],
},
{
type: 'category',
label: 'Tutorial',
items: ['tutorial/tutorial'],
},
{
type: 'category',
label: 'How it works',
Expand Down
16 changes: 9 additions & 7 deletions frontend/src/components/ConversationView/EmptyView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { CONVERSATION_VIEW_SELECTORS } from "./ConversationView.selectors"
const rag_examples = [
'Get started with AgentKit: "What is the quickest way to get started and run the code?"',
'Ask questions about the code: "How do I create a new tool?"',
'Explore the Github repo: "Visualize the number of commits per month this year"',
]

const opt_examples = [
Expand Down Expand Up @@ -41,9 +40,10 @@ const EmptyView = (props: Props) => {
</div>
<div className="mb-4 w-full px-4 py-3">
<div className="text-md font-medium">
<p>{" "}
I&apos;m an AgentKit codebase helper. I can answer questions about the documentation, codebase, Github
repository, and more.</p>
<p>
{" "}
I&apos;m an AgentKit codebase helper. I can answer questions about the documentation, codebase, and more.
</p>
</div>
<div className="mt-2 text-sm leading-loose text-gray-500 dark:text-gray-500">
<p>Here are some examples:</p>
Expand All @@ -54,9 +54,11 @@ const EmptyView = (props: Props) => {
</ol>
</div>
<div className="text-md font-medium">
<p>{" "}
I can also help you schedule your team&apos;s AgentKit project. Define your backlog, and I will create a
schedule for you.</p>
<p>
{" "}
I can also help you schedule your team&apos;s AgentKit project. Define your backlog, and I will create a
schedule for you.
</p>
</div>
<div className="mt-2 text-sm leading-loose text-gray-500 dark:text-gray-500">
<p>Here is an example:</p>
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/pages/auth/signin.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import Image from "next/image"
import { getServerSession } from "next-auth/next"
import { getCsrfToken, getProviders, signIn, useSession } from "next-auth/react"
import { useTheme } from "next-themes"
import { useEffect, useState } from "react"

import Icon from "~/components/CustomIcons/Icon"

import { authOptions } from "~/server/auth"
import { Theme } from "~/styles/themes"
import { useTheme } from "next-themes"
import { APPLICATION_TITLE, getMainLogoSrc } from "~/utils"
import { AUTH_SELECTORS } from "~/utils/signin.selectors"
import type { GetServerSidePropsContext, InferGetServerSidePropsType } from "next"
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ body,
@apply text-neutral;
}

[data-theme="dark"] code {
@apply !text-neutral;
}

@font-face {
font-family: "BCG Sans";
src: url("/fonts/sans/BCGHenSansRegular.ttf") format("ttf");
Expand Down

0 comments on commit 995e8a1

Please sign in to comment.