delete all projects
This commit is contained in:
parent
ed9aadebc4
commit
534a61349f
289
.gitignore
vendored
289
.gitignore
vendored
@ -1,289 +0,0 @@
|
|||||||
Created by https://www.toptal.com/developers/gitignore/api/pycharm,python
|
|
||||||
# Edit at https://www.toptal.com/developers/gitignore?templates=pycharm,python
|
|
||||||
|
|
||||||
### PyCharm ###
|
|
||||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
|
||||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
|
||||||
|
|
||||||
# User-specific stuff
|
|
||||||
.idea/**/workspace.xml
|
|
||||||
.idea/**/tasks.xml
|
|
||||||
.idea/**/usage.statistics.xml
|
|
||||||
.idea/**/dictionaries
|
|
||||||
.idea/**/shelf
|
|
||||||
|
|
||||||
# AWS User-specific
|
|
||||||
.idea/**/aws.xml
|
|
||||||
|
|
||||||
# Generated files
|
|
||||||
.idea/**/contentModel.xml
|
|
||||||
|
|
||||||
# Sensitive or high-churn files
|
|
||||||
.idea/**/dataSources/
|
|
||||||
.idea/**/dataSources.ids
|
|
||||||
.idea/**/dataSources.local.xml
|
|
||||||
.idea/**/sqlDataSources.xml
|
|
||||||
.idea/**/dynamic.xml
|
|
||||||
.idea/**/uiDesigner.xml
|
|
||||||
.idea/**/dbnavigator.xml
|
|
||||||
|
|
||||||
# Gradle
|
|
||||||
.idea/**/gradle.xml
|
|
||||||
.idea/**/libraries
|
|
||||||
|
|
||||||
# Gradle and Maven with auto-import
|
|
||||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
|
||||||
# since they will be recreated, and may cause churn. Uncomment if using
|
|
||||||
# auto-import.
|
|
||||||
# .idea/artifacts
|
|
||||||
# .idea/compiler.xml
|
|
||||||
# .idea/jarRepositories.xml
|
|
||||||
# .idea/modules.xml
|
|
||||||
# .idea/*.iml
|
|
||||||
# .idea/modules
|
|
||||||
# *.iml
|
|
||||||
# *.ipr
|
|
||||||
|
|
||||||
# CMake
|
|
||||||
cmake-build-*/
|
|
||||||
|
|
||||||
# Mongo Explorer plugin
|
|
||||||
.idea/**/mongoSettings.xml
|
|
||||||
|
|
||||||
# File-based project format
|
|
||||||
*.iws
|
|
||||||
|
|
||||||
# IntelliJ
|
|
||||||
out/
|
|
||||||
|
|
||||||
# mpeltonen/sbt-idea plugin
|
|
||||||
.idea_modules/
|
|
||||||
|
|
||||||
# JIRA plugin
|
|
||||||
atlassian-ide-plugin.xml
|
|
||||||
|
|
||||||
# Cursive Clojure plugin
|
|
||||||
.idea/replstate.xml
|
|
||||||
|
|
||||||
# SonarLint plugin
|
|
||||||
.idea/sonarlint/
|
|
||||||
|
|
||||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
|
||||||
com_crashlytics_export_strings.xml
|
|
||||||
crashlytics.properties
|
|
||||||
crashlytics-build.properties
|
|
||||||
fabric.properties
|
|
||||||
|
|
||||||
# Editor-based Rest Client
|
|
||||||
.idea/httpRequests
|
|
||||||
|
|
||||||
# Android studio 3.1+ serialized cache file
|
|
||||||
.idea/caches/build_file_checksums.ser
|
|
||||||
|
|
||||||
### PyCharm Patch ###
|
|
||||||
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
|
||||||
|
|
||||||
# *.iml
|
|
||||||
# modules.xml
|
|
||||||
# .idea/misc.xml
|
|
||||||
# *.ipr
|
|
||||||
|
|
||||||
# Sonarlint plugin
|
|
||||||
# https://plugins.jetbrains.com/plugin/7973-sonarlint
|
|
||||||
.idea/**/sonarlint/
|
|
||||||
|
|
||||||
# SonarQube Plugin
|
|
||||||
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
|
|
||||||
.idea/**/sonarIssues.xml
|
|
||||||
|
|
||||||
# Markdown Navigator plugin
|
|
||||||
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
|
|
||||||
.idea/**/markdown-navigator.xml
|
|
||||||
.idea/**/markdown-navigator-enh.xml
|
|
||||||
.idea/**/markdown-navigator/
|
|
||||||
|
|
||||||
# Cache file creation bug
|
|
||||||
# See https://youtrack.jetbrains.com/issue/JBR-2257
|
|
||||||
.idea/$CACHE_FILE$
|
|
||||||
|
|
||||||
# CodeStream plugin
|
|
||||||
# https://plugins.jetbrains.com/plugin/12206-codestream
|
|
||||||
.idea/codestream.xml
|
|
||||||
|
|
||||||
# Azure Toolkit for IntelliJ plugin
|
|
||||||
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
|
|
||||||
.idea/**/azureSettings.xml
|
|
||||||
|
|
||||||
### Python ###
|
|
||||||
# Byte-compiled / optimized / DLL files
|
|
||||||
__pycache__/
|
|
||||||
*.py[cod]
|
|
||||||
*$py.class
|
|
||||||
|
|
||||||
# C extensions
|
|
||||||
*.so
|
|
||||||
|
|
||||||
# Distribution / packaging
|
|
||||||
.Python
|
|
||||||
build/
|
|
||||||
develop-eggs/
|
|
||||||
dist/
|
|
||||||
downloads/
|
|
||||||
eggs/
|
|
||||||
.eggs/
|
|
||||||
lib/
|
|
||||||
lib64/
|
|
||||||
parts/
|
|
||||||
sdist/
|
|
||||||
var/
|
|
||||||
wheels/
|
|
||||||
share/python-wheels/
|
|
||||||
*.egg-info/
|
|
||||||
.installed.cfg
|
|
||||||
*.egg
|
|
||||||
MANIFEST
|
|
||||||
|
|
||||||
# PyInstaller
|
|
||||||
# Usually these files are written by a python script from a template
|
|
||||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
||||||
*.manifest
|
|
||||||
*.spec
|
|
||||||
|
|
||||||
# Installer logs
|
|
||||||
pip-log.txt
|
|
||||||
pip-delete-this-directory.txt
|
|
||||||
|
|
||||||
# Unit test / coverage reports
|
|
||||||
htmlcov/
|
|
||||||
.tox/
|
|
||||||
.nox/
|
|
||||||
.coverage
|
|
||||||
.coverage.*
|
|
||||||
.cache
|
|
||||||
nosetests.xml
|
|
||||||
coverage.xml
|
|
||||||
*.cover
|
|
||||||
*.py,cover
|
|
||||||
.hypothesis/
|
|
||||||
.pytest_cache/
|
|
||||||
cover/
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
*.mo
|
|
||||||
*.pot
|
|
||||||
|
|
||||||
# Django stuff:
|
|
||||||
*.log
|
|
||||||
local_settings.py
|
|
||||||
db.sqlite3
|
|
||||||
db.sqlite3-journal
|
|
||||||
|
|
||||||
# Flask stuff:
|
|
||||||
instance/
|
|
||||||
.webassets-cache
|
|
||||||
|
|
||||||
# Scrapy stuff:
|
|
||||||
.scrapy
|
|
||||||
|
|
||||||
# Sphinx documentation
|
|
||||||
docs/_build/
|
|
||||||
|
|
||||||
# PyBuilder
|
|
||||||
.pybuilder/
|
|
||||||
target/
|
|
||||||
|
|
||||||
# Jupyter Notebook
|
|
||||||
.ipynb_checkpoints
|
|
||||||
|
|
||||||
# IPython
|
|
||||||
profile_default/
|
|
||||||
ipython_config.py
|
|
||||||
|
|
||||||
# pyenv
|
|
||||||
# For a library or package, you might want to ignore these files since the code is
|
|
||||||
# intended to run in multiple environments; otherwise, check them in:
|
|
||||||
# .python-version
|
|
||||||
|
|
||||||
# pipenv
|
|
||||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
||||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
||||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
||||||
# install all needed dependencies.
|
|
||||||
#Pipfile.lock
|
|
||||||
|
|
||||||
# poetry
|
|
||||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
||||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
||||||
# commonly ignored for libraries.
|
|
||||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
||||||
#poetry.lock
|
|
||||||
|
|
||||||
# pdm
|
|
||||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
||||||
#pdm.lock
|
|
||||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
||||||
# in version control.
|
|
||||||
# https://pdm.fming.dev/#use-with-ide
|
|
||||||
.pdm.toml
|
|
||||||
|
|
||||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
||||||
__pypackages__/
|
|
||||||
|
|
||||||
# Celery stuff
|
|
||||||
celerybeat-schedule
|
|
||||||
celerybeat.pid
|
|
||||||
|
|
||||||
# SageMath parsed files
|
|
||||||
*.sage.py
|
|
||||||
|
|
||||||
# Environments
|
|
||||||
.env
|
|
||||||
.venv
|
|
||||||
env/
|
|
||||||
venv/
|
|
||||||
ENV/
|
|
||||||
env.bak/
|
|
||||||
venv.bak/
|
|
||||||
|
|
||||||
# Spyder project settings
|
|
||||||
.spyderproject
|
|
||||||
.spyproject
|
|
||||||
|
|
||||||
# Rope project settings
|
|
||||||
.ropeproject
|
|
||||||
|
|
||||||
# mkdocs documentation
|
|
||||||
/site
|
|
||||||
|
|
||||||
# mypy
|
|
||||||
.mypy_cache/
|
|
||||||
.dmypy.json
|
|
||||||
dmypy.json
|
|
||||||
|
|
||||||
# Pyre type checker
|
|
||||||
.pyre/
|
|
||||||
|
|
||||||
# pytype static type analyzer
|
|
||||||
.pytype/
|
|
||||||
|
|
||||||
# Cython debug symbols
|
|
||||||
cython_debug/
|
|
||||||
|
|
||||||
# PyCharm
|
|
||||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
||||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
||||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
||||||
#.idea/
|
|
||||||
|
|
||||||
### Python Patch ###
|
|
||||||
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
|
|
||||||
poetry.toml
|
|
||||||
|
|
||||||
# ruff
|
|
||||||
.ruff_cache/
|
|
||||||
|
|
||||||
# LSP config files
|
|
||||||
pyrightconfig.json
|
|
||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/pycharm,python
|
|
||||||
3
.idea/.gitignore
vendored
Normal file
3
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
10
.idea/ai-lawyer-agent.iml
Normal file
10
.idea/ai-lawyer-agent.iml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="jdk" jdkName="Python 3.13 (ai-lawyer-agent)" jdkType="Python SDK" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
12
.idea/inspectionProfiles/Project_Default.xml
Normal file
12
.idea/inspectionProfiles/Project_Default.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||||
|
<option name="ignoredErrors">
|
||||||
|
<list>
|
||||||
|
<option value="N802" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
6
.idea/misc.xml
Normal file
6
.idea/misc.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Black">
|
||||||
|
<option name="sdkName" value="Python 3.13 (ai-lawyer-agent)" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/ai-lawyer-agent.iml" filepath="$PROJECT_DIR$/.idea/ai-lawyer-agent.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@ -1,18 +0,0 @@
|
|||||||
|
|
||||||
[browser]
|
|
||||||
serverAddress = "localhost"
|
|
||||||
gatherUsageStats = false
|
|
||||||
serverPort = 8501
|
|
||||||
|
|
||||||
[theme]
|
|
||||||
base = "light"
|
|
||||||
backgroundColor = "#E6F4FF"
|
|
||||||
secondaryBackgroundColor = "#D6EDFF"
|
|
||||||
|
|
||||||
font = "Ubuntu, sans-serif"
|
|
||||||
baseFontSize = 16
|
|
||||||
baseFontWeight = 300
|
|
||||||
headingFont = "Ubuntu, sans-serif"
|
|
||||||
|
|
||||||
baseRadius = "small"
|
|
||||||
#borderColor = "#D6EDFF"
|
|
||||||
93
app/app.py
93
app/app.py
@ -1,93 +0,0 @@
|
|||||||
from datetime import datetime
|
|
||||||
import streamlit as st
|
|
||||||
from core.initialize_agent import assistant_agent
|
|
||||||
from core.stream_response import SQLiteSession
|
|
||||||
from app.components.sidebar import add_sidebar
|
|
||||||
|
|
||||||
style_chat_message = """
|
|
||||||
<style>
|
|
||||||
.st-emotion-cache-1rs7fk9 {
|
|
||||||
background-color: #D6EDFF;
|
|
||||||
border-radius: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.st-emotion-cache-1q1vt2q {
|
|
||||||
border-radius: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
"""
|
|
||||||
|
|
||||||
def get_time() -> str:
|
|
||||||
return datetime.now().strftime("%d.%m.%Y %H:%M:%S")
|
|
||||||
|
|
||||||
def init_session_state() -> None:
|
|
||||||
if "messages" not in st.session_state:
|
|
||||||
st.session_state.messages = []
|
|
||||||
if "chat_session" not in st.session_state:
|
|
||||||
st.session_state.chat_session = SQLiteSession(":memory:")
|
|
||||||
if "show_about" not in st.session_state:
|
|
||||||
st.session_state.show_about = True
|
|
||||||
|
|
||||||
st.markdown(style_chat_message, unsafe_allow_html=True)
|
|
||||||
|
|
||||||
def create_app() -> None:
|
|
||||||
|
|
||||||
st.set_page_config(
|
|
||||||
page_title="LawGPT",
|
|
||||||
page_icon="app/assets/images/title.png",
|
|
||||||
initial_sidebar_state="collapsed",
|
|
||||||
layout="centered",
|
|
||||||
menu_items={
|
|
||||||
'Get help': None,
|
|
||||||
'Report a bug': None,
|
|
||||||
'About': """
|
|
||||||
This is a cool educational project exploring the creation of an AI agent powered by API keys.
|
|
||||||
You can learn how to build, interact with, and experiment with AI using real API integration.
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_sidebar()
|
|
||||||
init_session_state()
|
|
||||||
|
|
||||||
for message in st.session_state.messages:
|
|
||||||
with st.chat_message(message["role"], avatar=message["avatar"]):
|
|
||||||
st.markdown(message["content"])
|
|
||||||
if "time" in message:
|
|
||||||
st.caption(message["time"])
|
|
||||||
|
|
||||||
user_avatar = "app/assets/images/user.png"
|
|
||||||
assistant_avatar = "app/assets/images/assistant.png"
|
|
||||||
|
|
||||||
if request := st.chat_input("Ask anything"):
|
|
||||||
user_time = get_time()
|
|
||||||
|
|
||||||
with st.chat_message(name="user", avatar=user_avatar):
|
|
||||||
st.markdown(f"{request}")
|
|
||||||
st.caption(user_time)
|
|
||||||
|
|
||||||
user_message = {"role": "user",
|
|
||||||
"avatar": user_avatar,
|
|
||||||
"content": request,
|
|
||||||
"time": user_time}
|
|
||||||
st.session_state.messages.append(user_message)
|
|
||||||
|
|
||||||
with st.chat_message(name="assistant", avatar=assistant_avatar):
|
|
||||||
with st.spinner("Thinking..."):
|
|
||||||
try:
|
|
||||||
response = st.write_stream(assistant_agent(request, st.session_state.chat_session))
|
|
||||||
except Exception as e:
|
|
||||||
response = f"️⚠️🌐 Error: {e}"
|
|
||||||
finally:
|
|
||||||
assistant_time = get_time()
|
|
||||||
|
|
||||||
st.caption(assistant_time)
|
|
||||||
|
|
||||||
assistant_message = {"role": "assistant",
|
|
||||||
"avatar": assistant_avatar,
|
|
||||||
"content": response,
|
|
||||||
"time": assistant_time}
|
|
||||||
st.session_state.messages.append(assistant_message)
|
|
||||||
|
|
||||||
st.rerun()
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB |
Binary file not shown.
Binary file not shown.
@ -1,32 +0,0 @@
|
|||||||
import streamlit as st
|
|
||||||
from agents import SQLiteSession
|
|
||||||
|
|
||||||
sidebar_style = """
|
|
||||||
<style>
|
|
||||||
[data-testid="stSidebar"][aria-expanded="true"]{
|
|
||||||
min-width: 300px;
|
|
||||||
max-width: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.stButton > button {
|
|
||||||
background-color: #D6EDFF;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.stButton > button:hover {
|
|
||||||
background-color: #D6EDFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
"""
|
|
||||||
|
|
||||||
def add_sidebar():
|
|
||||||
st.markdown(sidebar_style, unsafe_allow_html=True)
|
|
||||||
|
|
||||||
with st.sidebar:
|
|
||||||
|
|
||||||
st.title("⚖️ LawGPT")
|
|
||||||
st.markdown(":blue-badge[⚙️Tool] :orange-badge[⚠️Current chat will be deleted]")
|
|
||||||
if st.button(":material/note_stack_add: Create new chat"):
|
|
||||||
st.session_state.messages = []
|
|
||||||
st.session_state.chat_session = SQLiteSession(":memory:")
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
import httpx
|
|
||||||
|
|
||||||
async def fetch_api_data(icon: str, url: str, params: dict, remove_keys: list = None) -> dict:
|
|
||||||
try:
|
|
||||||
print(f"🔨{icon}Input parameters: {params}")
|
|
||||||
async with httpx.AsyncClient() as client:
|
|
||||||
response = await client.get(url, params=params, timeout=10.0)
|
|
||||||
response.raise_for_status()
|
|
||||||
print(f"🖇️{icon}Request URL: {response.url}")
|
|
||||||
|
|
||||||
data = response.json()
|
|
||||||
if remove_keys and isinstance(data, dict):
|
|
||||||
for key in remove_keys:
|
|
||||||
data.pop(key, None)
|
|
||||||
print(f"🚮{icon}Successfully removed key: {key}")
|
|
||||||
return data
|
|
||||||
|
|
||||||
except httpx.HTTPStatusError as e:
|
|
||||||
return {"error": "http_error", "status_code": e.response.status_code, "detail": e.response.text}
|
|
||||||
except httpx.RequestError as e:
|
|
||||||
return {"error": "request_error", "status_code": str(e)}
|
|
||||||
except Exception as e:
|
|
||||||
return {"error": "unexpected_error", "status_code": str(e)}
|
|
||||||
@ -1,178 +0,0 @@
|
|||||||
from pydantic import BaseModel, Field, conint
|
|
||||||
from typing import Optional, List, Literal
|
|
||||||
|
|
||||||
# =================================================================================================================
|
|
||||||
# COURT SCHEMAS
|
|
||||||
# =================================================================================================================
|
|
||||||
|
|
||||||
class Court(BaseModel):
|
|
||||||
query: Optional[str] = Field(None, description="Search term or phrase")
|
|
||||||
typSuduFacetFilter: Optional[List[str]] = Field(None, description="Court type (facet filter)")
|
|
||||||
krajFacetFilter: Optional[List[str]] = Field(None, description="Region (facet filter)")
|
|
||||||
okresFacetFilter: Optional[List[str]] = Field(None, description="District (facet filter)")
|
|
||||||
zahrnutZaniknuteSudy: Optional[bool] = Field(None, description="Flag to filter defunct/inactive courts")
|
|
||||||
page: Optional[conint(ge=1)] = Field(None, description="Requested page number (starting from 1)")
|
|
||||||
size: Optional[conint(ge=1)] = Field(None, description="Number of results per page")
|
|
||||||
indexDatumOd: Optional[str] = Field(None, description="Index date from (format YYYY-MM-DD)")
|
|
||||||
indexDatumDo: Optional[str] = Field(None, description="Index date to (format YYYY-MM-DD)")
|
|
||||||
sortProperty: Optional[str] = Field(None, description="Field to sort the output by")
|
|
||||||
sortDirection: Literal["ASC", "DESC"] = Field("ASC", description="Sort direction (ASC or DESC)")
|
|
||||||
|
|
||||||
class CourtID(BaseModel):
|
|
||||||
id: str = Field(..., description="Court identifier (e. g., sud_175)")
|
|
||||||
|
|
||||||
class CourtAutocomplete(BaseModel):
|
|
||||||
query: Optional[str] = Field(None, description="Search term or phrase")
|
|
||||||
limit: Optional[conint(ge=1)] = Field(None, description="Limits the number of returned results (pagination)")
|
|
||||||
|
|
||||||
|
|
||||||
# =================================================================================================================
|
|
||||||
# JUDGE SCHEMAS
|
|
||||||
# =================================================================================================================
|
|
||||||
|
|
||||||
class Judge(BaseModel):
|
|
||||||
query: Optional[str] = Field(None, description="Search term or phrase")
|
|
||||||
funkciaFacetFilter: Optional[List[str]] = Field(None, description="Judge function (facet filter)")
|
|
||||||
typSuduFacetFilter: Optional[List[str]] = Field(None, description="Court type (facet filter)")
|
|
||||||
krajFacetFilter: Optional[List[str]] = Field(None, description="Region (facet filter)")
|
|
||||||
okresFacetFilter: Optional[List[str]] = Field(None, description="District (facet filter)")
|
|
||||||
stavZapisuFacetFilter: Optional[List[str]] = Field(None, description="Record status (facet filter)")
|
|
||||||
guidSud: Optional[str] = Field(None, description="Court identifier (e.g., sud_100)")
|
|
||||||
indexDatumOd: Optional[str] = Field(None, description="Index date from (format YYYY-MM-DD)")
|
|
||||||
indexDatumDo: Optional[str] = Field(None, description="Index date to (format YYYY-MM-DD)")
|
|
||||||
page: Optional[conint(ge=1)] = Field(None, description="Requested page number (starting from 1)")
|
|
||||||
size: Optional[conint(ge=1)] = Field(None, description="Number of results per page")
|
|
||||||
sortProperty: Optional[str] = Field(None, description="Field to sort the output by")
|
|
||||||
sortDirection: Literal["ASC", "DESC"] = Field("ASC", description="Sort direction (ASC or DESC)")
|
|
||||||
|
|
||||||
class JudgeID(BaseModel):
|
|
||||||
id: str = Field(..., description="Judge identifier (e. g., sudca_1)")
|
|
||||||
|
|
||||||
class JudgeAutocomplete(BaseModel):
|
|
||||||
query: Optional[str] = Field(None, description="Search term or phrase")
|
|
||||||
guidSud: Optional[str] = Field(None, description="Court identifier (e.g., sud_100)")
|
|
||||||
limit: Optional[conint(ge=1)] = Field(None, description="Limits the number of returned results (pagination)")
|
|
||||||
|
|
||||||
|
|
||||||
# =================================================================================================================
|
|
||||||
# CONTRACTS SCHEMAS
|
|
||||||
# =================================================================================================================
|
|
||||||
|
|
||||||
class Contracts(BaseModel):
|
|
||||||
query: Optional[str] = Field(None, description="Search term or phrase")
|
|
||||||
typDokumentuFacetFilter: Optional[List[str]] = Field(None, description="Contract's type (facet filter)")
|
|
||||||
odberatelFacetFilter: Optional[List[str]] = Field(None, description="Subscriber filter")
|
|
||||||
dodavatelFacetFilter: Optional[List[str]] = Field(None, description="Supplier filter")
|
|
||||||
hodnotaZmluvyFacetFilter: Optional[List[str]] = Field(None, description="Contract value in EUR filter")
|
|
||||||
datumZverejeneniaOd: Optional[str] = Field(None, description="Index date from (format YYYY-MM-DD)")
|
|
||||||
datumZverejeneniaDo: Optional[str] = Field(None, description="Index date to (format YYYY-MM-DD)")
|
|
||||||
guidSud: Optional[str] = Field(None, description="Court identifier (e.g., sud_100)")
|
|
||||||
indexDatumOd: Optional[str] = Field(None, description="Index date from (format YYYY-MM-DD)")
|
|
||||||
indexDatumDo: Optional[str] = Field(None, description="Index date to (format YYYY-MM-DD)")
|
|
||||||
sortProperty: Optional[str] = Field(None, description="Field to sort the output by")
|
|
||||||
sortDirection: Literal["ASC", "DESC"] = Field("ASC", description="Sort direction (ASC or DESC)")
|
|
||||||
page: Optional[conint(ge=1)] = Field(None, description="Requested page number (starting from 1)")
|
|
||||||
size: Optional[conint(ge=1)] = Field(None, description="Number of results per page")
|
|
||||||
|
|
||||||
class ContractID(BaseModel):
|
|
||||||
idZmluvy: str = Field(..., description="Contract identifier (e. g., 2156252)")
|
|
||||||
|
|
||||||
class ContractAutocomplete(BaseModel):
|
|
||||||
query: Optional[str] = Field(None, description="Search term or phrase")
|
|
||||||
guidSud: Optional[str] = Field(None, description="Court identifier (e.g., sud_100)")
|
|
||||||
limit: Optional[conint(ge=1)] = Field(None, description="Limits the number of returned results (pagination)")
|
|
||||||
|
|
||||||
|
|
||||||
# =================================================================================================================
|
|
||||||
# DECISION SCHEMAS
|
|
||||||
# =================================================================================================================
|
|
||||||
|
|
||||||
class Decision(BaseModel):
|
|
||||||
query: Optional[str] = Field(None, description="Search term or phrase")
|
|
||||||
typSuduFacetFilter: Optional[List[str]] = Field(None, description="Court type (facet filter)")
|
|
||||||
krajFacetFilter: Optional[List[str]] = Field(None, description="Region (facet filter)")
|
|
||||||
okresFacetFilter: Optional[List[str]] = Field(None, description="District (facet filter)")
|
|
||||||
odkazovanePredpisy: Optional[str] = Field(None, description="Referenced regulations")
|
|
||||||
oblastPravnejUpravyFacetFilter: Optional[List[str]] = Field(None, description="Area of legal regulation (facet filter)")
|
|
||||||
podOblastPravnejUpravyFacetFilter: Optional[List[str]] = Field(None, description="Sub-area of legal regulation (facet filter)")
|
|
||||||
formaRozhodnutiaFacetFilter: Optional[List[str]] = Field(None, description="Form of decision (facet filter)")
|
|
||||||
povahaRozhodnutiaFacetFilter: Optional[str] = Field(None, description="Nature of decision")
|
|
||||||
vydaniaOd: Optional[str] = Field(None, description="Issue date from")
|
|
||||||
vydaniaDo: Optional[str] = Field(None, description="Issue date to")
|
|
||||||
ecli: Optional[str] = Field(None, description="ECLI identifier")
|
|
||||||
spisovaZnacka: Optional[str] = Field(None, description="Case reference number")
|
|
||||||
cisloSpisu: Optional[str] = Field(None, description="File identification number")
|
|
||||||
guidSudca: Optional[str] = Field(None, description="Judge identifier (e.g., sudca_1)")
|
|
||||||
guidSud: Optional[str] = Field(None, description="Court identifier (e.g., sud_100)")
|
|
||||||
indexDatumOd: Optional[str] = Field(None, description="Index date from (format YYYY-MM-DD)")
|
|
||||||
indexDatumDo: Optional[str] = Field(None, description="Index date to (format YYYY-MM-DD)")
|
|
||||||
sortProperty: Optional[str] = Field(None, description="Field to sort the output by")
|
|
||||||
sortDirection: Literal["ASC", "DESC"] = Field("ASC", description="Sort direction (ASC or DESC)")
|
|
||||||
page: Optional[conint(ge=1)] = Field(None, description="Requested page number (starting from 1)")
|
|
||||||
size: Optional[conint(ge=1)] = Field(None, description="Number of results per page")
|
|
||||||
|
|
||||||
class DecisionID(BaseModel):
|
|
||||||
id: str = Field(..., description="Decision identifier (e.g., a3310194-e9ac-4e6b-bfbd-25c40f26938b:1097de02-3389-405b-98a4-df7abea3f9ec)")
|
|
||||||
|
|
||||||
class DecisionAutocomplete(BaseModel):
|
|
||||||
query: Optional[str] = Field(None, description="Search term or phrase")
|
|
||||||
guidSud: Optional[str] = Field(None, description="Court identifier (e.g., sud_100)")
|
|
||||||
limit: Optional[conint(ge=1)] = Field(None, description="Limits the number of returned results (pagination)")
|
|
||||||
|
|
||||||
|
|
||||||
# =================================================================================================================
|
|
||||||
# CIVIL PROCEEDINGS SCHEMAS
|
|
||||||
# =================================================================================================================
|
|
||||||
|
|
||||||
class CivilProceedings(BaseModel):
|
|
||||||
query: Optional[str] = Field(None, description="Search term or phrase")
|
|
||||||
typSuduFacetFilter: Optional[List[str]] = Field(None, description="Court type (facet filter)")
|
|
||||||
krajFacetFilter: Optional[List[str]] = Field(None, description="Region (facet filter)")
|
|
||||||
okresFacetFilter: Optional[List[str]] = Field(None, description="District (facet filter)")
|
|
||||||
usekFacetFilter: Optional[List[str]] = Field(None, description="List of sections (facet filter)")
|
|
||||||
formaUkonuFacetFilter: Optional[List[str]] = Field(None, description="List of action types (facet filter)")
|
|
||||||
pojednavaniaOd: Optional[str] = Field(None, description="Hearing date from (DD.MM.YYYY)")
|
|
||||||
pojednavaniaDo: Optional[str] = Field(None, description="Hearing date to (DD.MM.YYYY)")
|
|
||||||
guidSudca: Optional[str] = Field(None, description="Judge identifier (e.g., sudca_1)")
|
|
||||||
guidSud: Optional[str] = Field(None, description="Court identifier (e.g., sud_100)")
|
|
||||||
spisovaZnacka: Optional[str] = Field(None,description="Case reference number")
|
|
||||||
verejneVyhlasenie: Optional[bool] = Field(None,description="Flag indicating whether the announcement is public")
|
|
||||||
indexDatumOd: Optional[str] = Field(None, description="Index date from (format YYYY-MM-DD)")
|
|
||||||
indexDatumDo: Optional[str] = Field(None, description="Index date to (format YYYY-MM-DD)")
|
|
||||||
sortProperty: Optional[str] = Field(None, description="Field to sort the output by")
|
|
||||||
sortDirection: Literal["ASC", "DESC"] = Field("ASC", description="Sort direction (ASC or DESC)")
|
|
||||||
page: Optional[conint(ge=1)] = Field(None, description="Requested page number (starting from 1)")
|
|
||||||
size: Optional[conint(ge=1)] = Field(None, description="Number of results per page")
|
|
||||||
|
|
||||||
class CivilProceedingsID(BaseModel):
|
|
||||||
id: str = Field(..., description="Identifier (e.g., 121e4d31-695e-41e1-9191-7c9ad5d8d484)")
|
|
||||||
|
|
||||||
class CivilProceedingsAutocomplete(BaseModel):
|
|
||||||
query: Optional[str] = Field(None, description="Search term or phrase")
|
|
||||||
guidSud: Optional[str] = Field(None, description="Court identifier (e.g., sud_100)")
|
|
||||||
guidSudca: Optional[str] = Field(None, description="Judge identifier (e.g., sudca_1)")
|
|
||||||
verejneVyhlasenie: Optional[bool] = Field(None,description="Flag indicating whether the announcement is public")
|
|
||||||
limit: Optional[conint(ge=1)] = Field(None, description="Limits the number of returned results (pagination)")
|
|
||||||
|
|
||||||
|
|
||||||
# =================================================================================================================
|
|
||||||
# ADMINISTRATIVE PROCEEDINGS SCHEMAS
|
|
||||||
# =================================================================================================================
|
|
||||||
|
|
||||||
class AdministrativeProceedings(BaseModel):
|
|
||||||
query: Optional[str] = Field(None, description="Search term or phrase")
|
|
||||||
druhFacetFilter: Optional[List[str]] = Field(None, description="List of types (faceted filter)")
|
|
||||||
datumPravoplatnostiOd: Optional[str] = Field(None, description="Validity date from (DD.MM.YYYY)")
|
|
||||||
datumPravoplatnostiDo: Optional[str] = Field(None, description="Validity date to (DD.MM.YYYY)")
|
|
||||||
page: Optional[conint(ge=1)] = Field(None, description="Requested page number (starting from 1)")
|
|
||||||
size: Optional[conint(ge=1)] = Field(None, description="Number of results per page")
|
|
||||||
sortProperty: Optional[str] = Field(None, description="Field to sort the output by")
|
|
||||||
sortDirection: Literal["ASC", "DESC"] = Field("ASC", description="Sort direction (ASC or DESC)")
|
|
||||||
|
|
||||||
class AdministrativeProceedingsID(BaseModel):
|
|
||||||
id: str = Field(..., description="Identifier of administrative proceedings (e.g., spravneKonanie_103)")
|
|
||||||
|
|
||||||
class AdministrativeProceedingsAutocomplete(BaseModel):
|
|
||||||
query: Optional[str] = Field(None, description="Search term or phrase")
|
|
||||||
limit: Optional[conint(ge=1)] = Field(None, description="Limits the number of returned results (pagination)")
|
|
||||||
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
from core.api.fetch_api_data import fetch_api_data
|
|
||||||
from core.api.schemas import (AdministrativeProceedings,
|
|
||||||
AdministrativeProceedingsID,
|
|
||||||
AdministrativeProceedingsAutocomplete)
|
|
||||||
from agents import function_tool
|
|
||||||
|
|
||||||
BASE_URL = "https://obcan.justice.sk/pilot/api/ress-isu-service"
|
|
||||||
|
|
||||||
class AdminProceedingsAPI:
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def admin_proceedings(self, params: AdministrativeProceedings) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch a list of administrative proceedings from the Justice API with optional filtering.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (AdministrativeProceedings): Filtering and pagination parameters.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: A dictionary containing a list of administrative proceedings and related metadata.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/spravneKonanie"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="✒️", url=url, params=params.model_dump(exclude_none=True))
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def admin_proceedings_id(self, params: AdministrativeProceedingsID) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch detailed information about a specific administrative proceeding by its identifier.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (AdministrativeProceedingsID): Unique identifier of the administrative proceeding.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: Details of the specified administrative proceeding.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/spravneKonanie/{params.id}"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="✒️", url=url, params=params.model_dump(exclude_none=True))
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def admin_proceedings_autocomplete(self, params: AdministrativeProceedingsAutocomplete) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch autocomplete suggestions for administrative proceeding search terms.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (AdministrativeProceedingsAutocomplete): Parameters for autocomplete query (e.g., partial text).
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: Suggested values matching the input query.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/spravneKonanie/autocomplete"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="✒️", url=url, params=params.model_dump(exclude_none=True))
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
from core.api.fetch_api_data import fetch_api_data
|
|
||||||
from core.api.schemas import (CivilProceedings,
|
|
||||||
CivilProceedingsID,
|
|
||||||
CivilProceedingsAutocomplete)
|
|
||||||
from agents import function_tool
|
|
||||||
|
|
||||||
BASE_URL = "https://obcan.justice.sk/pilot/api/ress-isu-service"
|
|
||||||
|
|
||||||
class CivilProceedingsAPI:
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def civil_proceedings(self, params: CivilProceedings) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch a list of civil proceedings and publicly announced judgments
|
|
||||||
from the Justice API with optional filtering.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (CivilProceedings): Filtering and pagination parameters.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: A dictionary containing a list of civil proceedings and related metadata.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/obcianPojednavania"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="🖊️", url=url, params=params.model_dump(exclude_none=True))
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def civil_proceedings_id(self, params: CivilProceedingsID) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch detailed information about a specific civil proceeding
|
|
||||||
and publicly announced judgment by its identifier.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (CivilProceedingsID): Unique identifier of the civil proceeding.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: Details of the specified civil proceeding and judgment.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/obcianPojednavania/{params.id}"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="🖊️", url=url, params=params.model_dump(exclude_none=True))
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def civil_proceedings_autocomplete(self, params: CivilProceedingsAutocomplete) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch autocomplete suggestions for civil proceeding search terms.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (CivilProceedingsAutocomplete): Parameters for autocomplete query (e.g., partial text).
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: Suggested values matching the input query.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/obcianPojednavania/autocomplete"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="🖊️", url=url, params=params.model_dump(exclude_none=True))
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
from core.api.fetch_api_data import fetch_api_data
|
|
||||||
from core.api.schemas import Contracts, ContractID, ContractAutocomplete
|
|
||||||
from agents import function_tool
|
|
||||||
|
|
||||||
BASE_URL = 'https://obcan.justice.sk/pilot/api/ress-isu-service'
|
|
||||||
|
|
||||||
class ContractsAPI:
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def contract(self, params: Contracts) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch a list of contracts from the Justice API with optional filtering.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (Contracts): Filtering and pagination parameters.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: A dictionary containing a list of contracts and related metadata.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/zmluvy"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="📃", url=url, params=params.model_dump(exclude_none=True))
|
|
||||||
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def contract_id(self, params: ContractID) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch detailed information about a specific contract by its identifier.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (ContractID): Unique identifier of the contract.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: Details of the specified contract.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/zmluvy/{params.id}"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="📃", url=url, params=params.model_dump(exclude_none=True))
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def contract_autocomplete(self, params: ContractAutocomplete) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch autocomplete suggestions for contract-related search terms.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (ContractAutocomplete): Parameters for autocomplete query (e.g., partial text).
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: Suggested values matching the input query.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/zmluvy/autocomplete"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="📃", url=url, params=params.model_dump(exclude_none=True))
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
from core.api.fetch_api_data import fetch_api_data
|
|
||||||
from core.api.schemas import Court, CourtID, CourtAutocomplete
|
|
||||||
from agents import function_tool
|
|
||||||
|
|
||||||
BASE_URL = 'https://obcan.justice.sk/pilot/api/ress-isu-service'
|
|
||||||
|
|
||||||
class CourtsAPI:
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def court(self, params: Court) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch a list of courts from the Justice API with optional filtering.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (Court): Filtering and pagination parameters.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: A dictionary containing a list of courts and related metadata.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/sud"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="🏛️️", url=url, params=params.model_dump(exclude_none=True))
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def court_id(self, params: CourtID) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch detailed information about a specific court by its identifier.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (CourtID): Unique identifier of the court.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: Details of the specified court.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/sud/{params.id}"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="🏛️️", url=url, params=params.model_dump(exclude_none=True), remove_keys=['foto'])
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def court_autocomplete(self, params: CourtAutocomplete) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch autocomplete suggestions for court names.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (CourtAutocomplete): Parameters for autocomplete.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: Suggested court names matching the input query.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/sud/autocomplete"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="🏛️️", url=url, params=params.model_dump(exclude_none=True))
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
from core.api.fetch_api_data import fetch_api_data
|
|
||||||
from core.api.schemas import Decision, DecisionID, DecisionAutocomplete
|
|
||||||
from agents import function_tool
|
|
||||||
|
|
||||||
BASE_URL = 'https://obcan.justice.sk/pilot/api/ress-isu-service'
|
|
||||||
|
|
||||||
class DecisionsAPI:
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def decision(self, params: Decision) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch a list of decisions from the Justice API with optional filtering.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (Decision): Filtering and pagination parameters.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: A dictionary containing a list of decisions and related metadata.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/rozhodnutie"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="⚖️️", url=url, params=params.model_dump(exclude_none=True))
|
|
||||||
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def decision_id(self, params: DecisionID) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch detailed information about a specific decision by its identifier.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (DecisionID): Unique identifier of the decision.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: Details of the specified decision.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/rozhodnutie/{params.id}"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="⚖️️", url=url, params=params.model_dump(exclude_none=True))
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def decision_autocomplete(self, params: DecisionAutocomplete) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch autocomplete suggestions for decision-related search terms.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (DecisionAutocomplete): Parameters for autocomplete.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: Suggested values matching the input query.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/rozhodnutie/autocomplete"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="⚖️️", url=url, params=params.model_dump(exclude_none=True))
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
from core.api.fetch_api_data import fetch_api_data
|
|
||||||
from core.api.schemas import Judge, JudgeID, JudgeAutocomplete
|
|
||||||
from agents import function_tool
|
|
||||||
|
|
||||||
BASE_URL = 'https://obcan.justice.sk/pilot/api/ress-isu-service'
|
|
||||||
|
|
||||||
class JudgesAPI:
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def judge(self, params: Judge) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch a list of judges from the Justice API with optional filtering.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (Judge): Filtering and pagination parameters.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: A dictionary containing a list of judges and related metadata.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/sudca"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="🧑⚖️", url=url, params=params.model_dump(exclude_none=True), remove_keys=['sudcaMapList'])
|
|
||||||
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def judge_id(self, params: JudgeID) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch detailed information about a specific judge by their identifier.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (JudgeID): Unique identifier of the judge.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: Details of the specified judge.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/sudca/{params.id}"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="🧑⚖️", url=url, params=params.model_dump(exclude_none=True))
|
|
||||||
|
|
||||||
|
|
||||||
@function_tool
|
|
||||||
async def judge_autocomplete(self, params: JudgeAutocomplete) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch autocomplete suggestions for judges' names.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
params (JudgeAutocomplete): Parameters for autocomplete query (e.g., partial name).
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: Suggested judge names matching the input query.
|
|
||||||
"""
|
|
||||||
url = f"{BASE_URL}/v1/sudca/autocomplete"
|
|
||||||
|
|
||||||
return await fetch_api_data(icon="🧑⚖️", url=url, params=params.model_dump(exclude_none=True))
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
from agents import Agent
|
|
||||||
from agents import OpenAIChatCompletionsModel, AsyncOpenAI, ModelSettings
|
|
||||||
from agents import set_tracing_disabled, enable_verbose_stdout_logging
|
|
||||||
|
|
||||||
from core.system_prompt import SYSTEM_PROMPT
|
|
||||||
from core.stream_response import stream_response
|
|
||||||
|
|
||||||
from core.api.tools.judges import JudgesAPI
|
|
||||||
from core.api.tools.coutrs import CourtsAPI
|
|
||||||
from core.api.tools.contracts import ContractsAPI
|
|
||||||
from core.api.tools.decisions import DecisionsAPI
|
|
||||||
from core.api.tools.admin_proceedings import AdminProceedingsAPI
|
|
||||||
from core.api.tools.civil_proceedings import CivilProceedingsAPI
|
|
||||||
|
|
||||||
set_tracing_disabled(True)
|
|
||||||
#enable_verbose_stdout_logging()
|
|
||||||
|
|
||||||
class BaseAgent(Agent[None]): pass
|
|
||||||
|
|
||||||
def assistant_agent(prompt: str, session):
|
|
||||||
|
|
||||||
judge_api = JudgesAPI()
|
|
||||||
court_api = CourtsAPI()
|
|
||||||
contract_api = ContractsAPI()
|
|
||||||
decision_api = DecisionsAPI()
|
|
||||||
admin_proceedings_api = AdminProceedingsAPI()
|
|
||||||
civil_proceedings_api = CivilProceedingsAPI()
|
|
||||||
|
|
||||||
model = OpenAIChatCompletionsModel(
|
|
||||||
model="gpt-oss:20b-cloud",
|
|
||||||
openai_client=AsyncOpenAI(base_url="http://localhost:11434/v1",
|
|
||||||
api_key="ollama"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
agent = BaseAgent(
|
|
||||||
name="Assistant",
|
|
||||||
instructions=SYSTEM_PROMPT,
|
|
||||||
model=model,
|
|
||||||
model_settings=ModelSettings(
|
|
||||||
temperature=0.1,
|
|
||||||
tool_choice="auto",
|
|
||||||
parallel_tool_calls=False,
|
|
||||||
max_tokens=512,
|
|
||||||
),
|
|
||||||
tools=[
|
|
||||||
judge_api.judge, judge_api.judge_id, judge_api.judge_autocomplete,
|
|
||||||
court_api.court, court_api.court_id, court_api.court_autocomplete,
|
|
||||||
contract_api.contract, contract_api.contract_id, contract_api.contract_autocomplete,
|
|
||||||
decision_api.decision, decision_api.decision_id, decision_api.decision_autocomplete,
|
|
||||||
admin_proceedings_api.admin_proceedings, admin_proceedings_api.admin_proceedings_id, admin_proceedings_api.admin_proceedings_autocomplete,
|
|
||||||
civil_proceedings_api.civil_proceedings, civil_proceedings_api.civil_proceedings_id, civil_proceedings_api.civil_proceedings_autocomplete,
|
|
||||||
],
|
|
||||||
tool_use_behavior="run_llm_again",
|
|
||||||
reset_tool_choice=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
return stream_response(agent, prompt, session)
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
from agents import Agent, Runner, SQLiteSession
|
|
||||||
from openai.types.responses import ResponseTextDeltaEvent
|
|
||||||
|
|
||||||
async def stream_response(agent: Agent, prompt: str, session: SQLiteSession):
|
|
||||||
"""Stream agent response and update the UI."""
|
|
||||||
|
|
||||||
try:
|
|
||||||
result = Runner.run_streamed(agent, input=prompt, session=session)
|
|
||||||
async for event in result.stream_events():
|
|
||||||
if event.type == "raw_response_event" and isinstance(event.data, ResponseTextDeltaEvent):
|
|
||||||
yield event.data.delta # <-- sends the next piece of response text
|
|
||||||
except Exception as e:
|
|
||||||
yield f"⚠️🖨️ Error: {e}"
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
SYSTEM_PROMPT = """
|
|
||||||
"""
|
|
||||||
7
main.py
7
main.py
@ -1,7 +0,0 @@
|
|||||||
from app.app import create_app
|
|
||||||
|
|
||||||
def main():
|
|
||||||
create_app()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
openai-agents
|
|
||||||
python-dotenv
|
|
||||||
streamlit
|
|
||||||
requests
|
|
||||||
pydantic
|
|
||||||
httpx
|
|
||||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 255 KiB |
Loading…
Reference in New Issue
Block a user