From e2eb9f90ed16ed86a86fe2369f3cb479c24ae004 Mon Sep 17 00:00:00 2001 From: OwusuBlessing Date: Thu, 11 Sep 2025 23:16:57 +0100 Subject: [PATCH] updated env --- .gitignore | 149 ++++++++++++++++++++++------ intro_test/openai_test/data/kb.json | 24 +++++ test.py | 62 ++++++++++++ 3 files changed, 202 insertions(+), 33 deletions(-) create mode 100644 intro_test/openai_test/data/kb.json create mode 100644 test.py diff --git a/.gitignore b/.gitignore index 104a94a..3d12101 100644 --- a/.gitignore +++ b/.gitignore @@ -1,44 +1,127 @@ -# Ignore virtual environment -venv/ -groq_keys.json -cerebras_keys.json -# Ignore Python cache files +# Byte-compiled / optimized / DLL files __pycache__/ +*.py[cod] +*$py.class -# Ignore Jupyter Notebook checkpoints -.ipynb_checkpoints/ +# C extensions +*.so -# Ignore log files -*.log -test.py +# 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 -# Ignore data directory -data/ +# PyInstaller +*.manifest +*.spec -# Ignore all .docx and .pdf files -*.docx -*.pdf -test_keys.py +# Installer logs +pip-log.txt +pip-delete-this-directory.txt -# Ignore all files in specs/ directory -specs/* -chronobid/* +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +*.hypothesis/ +.pytest_cache/ +cover/ -# Except for scp_engr_doc.json in specs/ directory -!specs/scp_engr_doc.json -!specs/Aienergy.discipline.json -!specs/Aienergy.discipline.criteria.json +# Jupyter Notebook +.ipynb_checkpoints -db.sqlite3 -services/lab.html -env.json +# IPython +profile_default/ +ipython_config.py -api.json +# pyenv +.python-version +# pipenv +Pipfile.lock + +# poetry +poetry.lock + +# uv +.uv/ +uv.lock + +# PDM +.pdm.toml +__pypackages__/ + +# pyflow +.pyflow/ + +# Celery +celerybeat-schedule +celerybeat.pid + +# SageMath +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder +.spyderproject +.spyproject + +# Rope +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +.idea/ + +# VS Code / Cursor +.vscode/ +.history/ + +# MacOS .DS_Store -_venv -testing_grounds.py -claude_messages.json -.env.production - -docs/flask_apispec diff --git a/intro_test/openai_test/data/kb.json b/intro_test/openai_test/data/kb.json new file mode 100644 index 0000000..d936352 --- /dev/null +++ b/intro_test/openai_test/data/kb.json @@ -0,0 +1,24 @@ + +[ + { + "question": "What is our company's vacation policy?", + "answer": "Full-time employees are entitled to 20 paid vacation days per year. Vacation days can be taken after completing 6 months of employment. Unused vacation days can be carried over to the next year up to a maximum of 5 days. Vacation requests should be submitted at least 2 weeks in advance through the HR portal." + }, + { + "question": "How do I request a new software license?", + "answer": "To request a new software license, please submit a ticket through the IT Service Desk portal. Include the software name, version, and business justification. Standard software licenses are typically approved within 2 business days. For specialized software, approval may take up to 5 business days and may require department head approval." + }, + { + "question": "What is our remote work policy?", + "answer": "Our company follows a hybrid work model. Employees can work remotely up to 3 days per week. Remote work days must be coordinated with your team and approved by your direct manager. All remote work requires a stable internet connection and a dedicated workspace. Core collaboration hours are 10:00 AM to 3:00 PM EST." + }, + { + "question": "How do I submit an expense report?", + "answer": "Expense reports should be submitted through the company's expense management system. Include all receipts, categorize expenses appropriately, and add a brief description for each entry. Reports must be submitted within 30 days of the expense. For expenses over $100, additional documentation may be required. All reports require manager approval." + }, + { + "question": "What is our process for reporting a security incident?", + "answer": "If you discover a security incident, immediately contact the Security Team at security@company.com or call the 24/7 security hotline. Do not attempt to investigate or resolve the incident yourself. Document what you observed, including timestamps and affected systems. The Security Team will guide you through the incident response process and may need your assistance for investigation." + } + ] + \ No newline at end of file diff --git a/test.py b/test.py new file mode 100644 index 0000000..3e518b3 --- /dev/null +++ b/test.py @@ -0,0 +1,62 @@ +import asyncio +import nest_asyncio +from mcp import ClientSession +from mcp.client.sse import sse_client + +nest_asyncio.apply() # Needed to run interactive python + +""" +Make sure: +1. The server is running before running this script. +2. The server is configured to use SSE transport. +3. The server is listening on port 8050. + +To run the server: +uv run server.py +""" + + +async def main(): + # Connect to the server using SSE + async with sse_client("http://localhost:8050/sse") as (read_stream, write_stream): + async with ClientSession(read_stream, write_stream) as session: + # Initialize the connection + await session.initialize() + + # List available tools + tools_result = await session.list_tools() + print("Available tools:") + for tool in tools_result.tools: + print(f" - {tool.name}: {tool.description}") + + # List available prompts + prompts_result = await session.list_prompts() + print(f"\nAvailable prompts ({len(prompts_result.prompts)}):") + for prompt in prompts_result.prompts: + print(f" - {prompt.name}: {prompt.description}") + + # List available resources + resources_result = await session.list_resources() + print(f"\nAvailable resources ({len(resources_result.resources)}):") + for resource in resources_result.resources: + print(f" - {resource.uri}: {resource.name}") + if resource.description: + print(f" Description: {resource.description}") + if hasattr(resource, 'mime_type') and resource.mime_type: + print(f" MIME Type: {resource.mime_type}") + + # Test a simple tool call (if any tools are available) + if tools_result.tools: + print(f"\nTesting tool execution with '{tools_result.tools[0].name}':") + try: + # Try to call the first available tool with empty arguments to see what happens + result = await session.call_tool(tools_result.tools[0].name, arguments={}) + print(f"Tool result: {result.content[0].text if result.content else 'No content'}") + except Exception as e: + print(f"Tool execution failed: {e}") + else: + print("\nNo tools available to test.") + + +if __name__ == "__main__": + asyncio.run(main()) \ No newline at end of file