34 |
35 |
36 | Start the chat by providing a goal.
37 |
38 |
Try the examples given below!
39 |
40 |
41 | {/* Input Box */}
42 |
43 | {
49 | if (e.key === "Enter") handleSend();
50 | }}
51 | onChange={(e) => setPrompt(e.target.value)}
52 | />
53 |
66 |
67 |
68 | {/* Example Cards */}
69 |
70 | {DUMMY_PROMPTS.map((example, index) => (
71 |
{
75 | setMessages((prev) => {
76 | return [
77 | ...prev,
78 | {
79 | role: "user",
80 | prompt: example,
81 | },
82 | {
83 | role: "system",
84 | data: [],
85 | },
86 | ];
87 | });
88 | }}
89 | >
90 |
91 |
{example}
92 |
93 | ))}
94 |
95 |
96 | );
97 | };
98 |
99 | export default Playground;
100 |
--------------------------------------------------------------------------------
/frontend/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: ["class"],
4 | content: ["./index.html", "./src/**/*.{ts,tsx,js,jsx}"],
5 | theme: {
6 | fontSize: {
7 | "xsm": '11px',
8 | sm: '13px',
9 | base: '15px',
10 | xl: '17px',
11 | '2xl': '21px',
12 | // '3xl': '1.953rem',
13 | // '4xl': '2.441rem',
14 | // '5xl': '3.052rem',
15 | },
16 | fontWeight: {
17 | thin: '100',
18 | extralight: '200',
19 | light: '300',
20 | normal: '400',
21 | medium: '500',
22 | semibold: '600',
23 | bold: '700',
24 | extrabold: '800',
25 | black: '900',
26 | },
27 | extend: {
28 | borderRadius: {
29 | lg: 'var(--radius)',
30 | md: 'calc(var(--radius) - 2px)',
31 | sm: 'calc(var(--radius) - 6px)'
32 | },
33 | colors: {
34 | background: 'hsl(var(--background))',
35 | foreground: 'hsl(var(--foreground))',
36 | card: {
37 | DEFAULT: 'hsl(var(--card))',
38 | foreground: 'hsl(var(--card-foreground))'
39 | },
40 | popover: {
41 | DEFAULT: 'hsl(var(--popover))',
42 | foreground: 'hsl(var(--popover-foreground))',
43 | secondary: 'hsl(var(--popover-secondary))'
44 | },
45 | primary: {
46 | DEFAULT: 'hsl(var(--primary))',
47 | foreground: 'hsl(var(--primary-foreground))',
48 | success: 'hsla(var(--success))'
49 | },
50 | secondary: {
51 | DEFAULT: 'hsl(var(--secondary))',
52 | foreground: 'hsl(var(--secondary-foreground))'
53 | },
54 | muted: {
55 | DEFAULT: 'hsl(var(--muted))',
56 | foreground: 'hsl(var(--muted-foreground))'
57 | },
58 | accent: {
59 | DEFAULT: 'hsl(var(--accent))',
60 | foreground: 'hsl(var(--accent-foreground))'
61 | },
62 | destructive: {
63 | DEFAULT: 'hsl(var(--destructive))',
64 | foreground: 'hsl(var(--destructive-foreground))'
65 | },
66 | border: 'hsl(var(--border))',
67 | input: 'hsl(var(--input))',
68 | ring: 'hsl(var(--ring))',
69 | disabled: {
70 | foreground: 'hsl(var(--disabled-foreground))',
71 | },
72 | chart: {
73 | '1': 'hsl(var(--chart-1))',
74 | '2': 'hsl(var(--chart-2))',
75 | '3': 'hsl(var(--chart-3))',
76 | '4': 'hsl(var(--chart-4))',
77 | '5': 'hsl(var(--chart-5))'
78 | }
79 | },
80 | keyframes: {
81 | 'accordion-down': {
82 | from: {
83 | height: '0'
84 | },
85 | to: {
86 | height: 'var(--radix-accordion-content-height)'
87 | }
88 | },
89 | 'accordion-up': {
90 | from: {
91 | height: 'var(--radix-accordion-content-height)'
92 | },
93 | to: {
94 | height: '0'
95 | }
96 | },
97 | 'jump': {
98 | '0%, 100%': {
99 | transform: 'translateY(0)',
100 | animationTimingFunction: 'cubic-bezier(0.8, 0, 1, 1)',
101 | },
102 | '50%': {
103 | transform: 'translateY(-8px)',
104 | animationTimingFunction: 'cubic-bezier(0, 0, 0.2, 1)',
105 | },
106 | },
107 | },
108 | animation: {
109 | 'accordion-down': 'accordion-down 0.2s ease-out',
110 | 'accordion-up': 'accordion-up 0.2s ease-out',
111 | 'jump': 'jump 1s infinite',
112 | }
113 | }
114 | },
115 | plugins: [require("tailwindcss-animate")],
116 | }
117 |
--------------------------------------------------------------------------------
/agentic_bench/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | share/python-wheels/
24 | *.egg-info/
25 | .installed.cfg
26 | *.egg
27 | MANIFEST
28 |
29 | # PyInstaller
30 | # Usually these files are written by a python script from a template
31 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
32 | *.manifest
33 | *.spec
34 |
35 | # Installer logs
36 | pip-log.txt
37 | pip-delete-this-directory.txt
38 |
39 | # Unit test / coverage reports
40 | terminal_logs/*
41 | htmlcov/
42 | .tox/
43 | .nox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | *.py,cover
51 | .hypothesis/
52 | .pytest_cache/
53 | cover/
54 |
55 | # Translations
56 | *.mo
57 | *.pot
58 |
59 | # Django stuff:
60 | *.log
61 | local_settings.py
62 | db.sqlite3
63 | db.sqlite3-journal
64 |
65 | # Flask stuff:
66 | instance/
67 | .webassets-cache
68 |
69 | # Scrapy stuff:
70 | .scrapy
71 |
72 | # Sphinx documentation
73 | docs/_build/
74 |
75 | # PyBuilder
76 | .pybuilder/
77 | target/
78 |
79 | # Jupyter Notebook
80 | .ipynb_checkpoints
81 |
82 | # IPython
83 | profile_default/
84 | ipython_config.py
85 |
86 | # pyenv
87 | # For a library or package, you might want to ignore these files since the code is
88 | # intended to run in multiple environments; otherwise, check them in:
89 | # .python-version
90 |
91 | # pipenv
92 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
94 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
95 | # install all needed dependencies.
96 | #Pipfile.lock
97 |
98 | # UV
99 | # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100 | # This is especially recommended for binary packages to ensure reproducibility, and is more
101 | # commonly ignored for libraries.
102 | #uv.lock
103 |
104 | # poetry
105 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106 | # This is especially recommended for binary packages to ensure reproducibility, and is more
107 | # commonly ignored for libraries.
108 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109 | #poetry.lock
110 |
111 | # pdm
112 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113 | #pdm.lock
114 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
115 | # in version control.
116 | # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
117 | .pdm.toml
118 | .pdm-python
119 | .pdm-build/
120 |
121 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
122 | __pypackages__/
123 |
124 | # Celery stuff
125 | celerybeat-schedule
126 | celerybeat.pid
127 |
128 | # SageMath parsed files
129 | *.sage.py
130 |
131 | # Environments
132 | ../.env
133 | .venv
134 | env/
135 | venv/
136 | ENV/
137 | env.bak/
138 | venv.bak/
139 |
140 | # Spyder project settings
141 | .spyderproject
142 | .spyproject
143 |
144 | # Rope project settings
145 | .ropeproject
146 |
147 | # mkdocs documentation
148 | /site
149 |
150 | # mypy
151 | .mypy_cache/
152 | .dmypy.json
153 | dmypy.json
154 |
155 | # Pyre type checker
156 | .pyre/
157 |
158 | # pytype static type analyzer
159 | .pytype/
160 |
161 | # Cython debug symbols
162 | cython_debug/
163 |
164 | # PyCharm
165 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
166 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
167 | # and can be added to the global gitignore or merged into this file. For a more nuclear
168 | # option (not recommended) you can uncomment the following to ignore the entire idea folder.
169 | #.idea/
170 |
171 | # PyPI configuration file
172 | .pypirc
173 |
174 | .logfire
175 | code_files
--------------------------------------------------------------------------------
/agentic_bench/utils/initializers/rag_constants.py:
--------------------------------------------------------------------------------
1 | from pathlib import Path
2 |
3 | PDF_DIRECTORY = Path(__file__).resolve().parents[2] / 'Pdf_data_folder'
4 | WORKING_DIR = Path(__file__).resolve().parents[2] / 'graph_data_folder'
5 |
6 | rag_system_prompt = """You are a helpful AI assistant that processes queries using RAG (Retrieval Augmented Generation).
7 | Use the provided RAG system to retrieve relevant information and generate comprehensive responses.
8 | Always aim to provide accurate and contextual information based on the retrieved content.
9 | If you don't know the answer, just say that you don't know and return a bool of False.
10 | Also, tell the user that these entities were used to generate the response.
11 | Use the provided tools to retrieve information and answer the user's question.
12 | MAKE SURE YOU CALL THE PROVIDED TOOLS ATLEAST ONCE TO GET THE ANSWER.
13 |
14 | """
15 | rag_description = " An AI assistant specialized in answering from users using the data uploaded by user"
16 |
17 | DOMAIN = (
18 | "Analyze and interpret financial reports, including 10-K and 10-Q filings, "
19 | "to provide actionable insights into the company's financial performance, "
20 | "cash flows, risks, strategies, and operational efficiency. The analysis "
21 | "should focus on key financial metrics such as net cash flow, revenue, "
22 | "expenses, liabilities, and assets, as well as qualitative factors like "
23 | "strategies for growth, risk mitigation approaches, and overall financial health. "
24 | "In addition, extract data trends, compare performance across periods, and "
25 | "identify anomalies or significant changes."
26 | )
27 |
28 | EXAMPLE_QUERIES = [
29 | "What is the net cash from operating activities in the Q3 2022 report?",
30 | "What are the key risks highlighted in the latest 10-K filing?",
31 | "What strategies did the company implement for revenue growth?",
32 | "What are the significant changes in expenses compared to the previous quarter?",
33 | "What are the projected cash flows for the next quarter?",
34 | "What was the year-over-year growth in revenue based on the 2021 and 2022 reports?",
35 | "What are the company's largest operating expenses, and how have they changed over time?",
36 | "Which risks related to market conditions were discussed in the latest 10-Q filing?",
37 | "What is the company's current debt-to-equity ratio as stated in the financial reports?",
38 | "How does the company's net income trend over the last four quarters?",
39 | "What are the major drivers of cash flow from investing activities?",
40 | "Which new strategies for cost reduction were outlined in the latest 10-K?",
41 | "How does the company plan to address risks associated with supply chain disruptions?",
42 | "What are the main contributors to changes in net working capital compared to the previous year?",
43 | "Has the company made any major acquisitions, and what financial impact did they report?",
44 | "What are the primary factors affecting gross margin in recent reports?",
45 | "What operational efficiencies were highlighted as key achievements in the latest filings?",
46 | "what is the value of common share price in Q3?"
47 | ]
48 |
49 | ENTITY_TYPES = [
50 | "Revenue",
51 | "Expense",
52 | "Cash Flow",
53 | "Net Income",
54 | "Profit Margin",
55 | "Risk",
56 | "Strategy",
57 | "Asset",
58 | "Liability",
59 | "Equity",
60 | "Debt",
61 | "Investments",
62 | "Operating Expenses",
63 | "Capital Expenditures",
64 | "Net Working Capital",
65 | "Acquisitions",
66 | "Market Trends",
67 | "Supply Chain",
68 | "Cost Reduction",
69 | "Growth Strategy",
70 | "Tax Implications",
71 | "Regulatory Compliance",
72 | "Operational Efficiency",
73 | "Financial Ratios"
74 | ]
75 |
76 | SYSTEM_PROMPT = """You are a helpful AI assistant that processes queries using RAG (Retrieval Augmented Generation).
77 | Use the provided RAG system to retrieve relevant information and generate comprehensive responses.
78 | Always aim to provide accurate and contextual information based on the retrieved content.
79 | If you don't know the answer, just say that you don't know and return a bool of False.
80 | Also, tell the user that these entities were used to generate the response.
81 | """
82 |
83 | AGENT_DESCRIPTION_FINANCE = """ RAG agent for extracting precise numerical data from corporate financial statements and reports using access to verified corporate financial records and reports in its knowledge base. """
84 |
85 | AGENT_DESCRIPTION_RESEARCH_PAPERS = """ RAG Agent for answering questions related to academics, research papers, and technical publications in AI, ML, and NLP domains to deliver scholarly insights. """
--------------------------------------------------------------------------------
/agentic_bench/utils/image.py:
--------------------------------------------------------------------------------
1 | from __future__ import annotations
2 |
3 | import base64
4 | import re
5 | from io import BytesIO
6 | from pathlib import Path
7 | from typing import Any, cast
8 |
9 | import aiohttp
10 | from openai.types.chat import ChatCompletionContentPartImageParam
11 | from PIL import Image as PILImage
12 | from pydantic import GetCoreSchemaHandler, ValidationInfo
13 | from pydantic_core import core_schema
14 | from typing_extensions import Literal
15 |
16 | class Image:
17 | def __init__(self, image: PILImage.Image):
18 | self.image: PILImage.Image = image.convert("RGB")
19 |
20 | @classmethod
21 | def from_pil(cls, pil_image: PILImage.Image) -> Image:
22 | return cls(pil_image)
23 |
24 | @classmethod
25 | def from_uri(cls, uri: str) -> Image:
26 | if not re.match(r"data:image/(?:png|jpeg);base64,", uri):
27 | raise ValueError(
28 | "Invalid URI format. It should be a base64 encoded image URI."
29 | )
30 |
31 | # A URI. Remove the prefix and decode the base64 string.
32 | base64_data = re.sub(r"data:image/(?:png|jpeg);base64,", "", uri)
33 | return cls.from_base64(base64_data)
34 |
35 | @classmethod
36 | async def from_url(cls, url: str) -> Image:
37 | async with aiohttp.ClientSession() as session:
38 | async with session.get(url) as response:
39 | content = await response.read()
40 | return cls(PILImage.open(content))
41 |
42 | @classmethod
43 | def from_base64(cls, base64_str: str) -> Image:
44 | return cls(PILImage.open(BytesIO(base64.b64decode(base64_str))))
45 |
46 | def to_base64(self) -> str:
47 | buffered = BytesIO()
48 | self.image.save(buffered, format="PNG")
49 | content = buffered.getvalue()
50 | return base64.b64encode(content).decode("utf-8")
51 |
52 | @classmethod
53 | def from_file(cls, file_path: Path) -> Image:
54 | return cls(PILImage.open(file_path))
55 |
56 | def _repr_html_(self) -> str:
57 | # Show the image in Jupyter notebook
58 | return f'