{"id":18365691,"url":"https://github.com/denniszielke/sql-ai-agents","last_synced_at":"2025-04-06T16:31:32.561Z","repository":{"id":251176469,"uuid":"835283622","full_name":"denniszielke/sql-ai-agents","owner":"denniszielke","description":"Demo implementation of a reactive multi agent bot that can answer questions based on relational database information to demonstrate different architecture pattern.","archived":false,"fork":false,"pushed_at":"2025-03-04T12:02:13.000Z","size":1766,"stargazers_count":12,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-22T03:23:43.097Z","etag":null,"topics":["agent-based","azure","azure-openai","azure-sql","container-apps","generative-ai","langchain-python","langraph"],"latest_commit_sha":null,"homepage":"","language":"TSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/denniszielke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-29T14:18:14.000Z","updated_at":"2025-03-17T01:12:00.000Z","dependencies_parsed_at":"2025-01-27T12:41:45.152Z","dependency_job_id":null,"html_url":"https://github.com/denniszielke/sql-ai-agents","commit_stats":null,"previous_names":["denniszielke/sql-ai-agents"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denniszielke%2Fsql-ai-agents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denniszielke%2Fsql-ai-agents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denniszielke%2Fsql-ai-agents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denniszielke%2Fsql-ai-agents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denniszielke","download_url":"https://codeload.github.com/denniszielke/sql-ai-agents/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247512684,"owners_count":20950904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent-based","azure","azure-openai","azure-sql","container-apps","generative-ai","langchain-python","langraph"],"created_at":"2024-11-05T23:14:19.217Z","updated_at":"2025-04-06T16:31:32.141Z","avatar_url":"https://github.com/denniszielke.png","language":"TSQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Talking to a database with a large language model\n\nThis project demonstrates different approaches on how to implement a bot that can talk to a relational database using different architecture patterns.\n\nThis allows you to enter abstract questions that the bot will try to answer by reasoning over the available data structures using a vector database, create a plan to query the data and iterate over possible queries and finally execute the query. If anything goes wrong or does not look correct the bot will identify issues and fix them automatically.\n\nThe question can be something like that:\n![image info](./img/question.png)\n\nThe bot will use tools to solve the problem:\n![image info](./img/tools_used.png)\n\nAfter different iterations the bot will be able generate a SQL query:\n![image info](./img/query.png)\n\nAnd finally it will come up with a way to output the response in a suitable format:\n![image info](./img/output.png)\n\nIt will also plot the path taken and the amount of tokens used\n![image info](./img/plan.png)\n\n## Implementation patterns\n\nTo compare efficiency, reliability, creativity and scalability we have implemented the following different architecture patterns for this:\n\n1.) Simple prompt\n\n![image info](./img/simple.png)\n\n2.) ReAct based Prompt\n\n![image info](./img/tools.png)\n\n3.) Multi agent\n\n![image info](./img/agents.png)\n\n4.) AI Search optimized agents\n\n![image info](./img/embeded-agents.png)\n\n## Deploy Infrastructure\n\n```\necho \"log into azure dev cli - only once\"\nazd auth login\n\necho \"provisioning all the resources with the azure dev cli\"\nazd up\n\necho \"get and set the value for AZURE_ENV_NAME\"\nsource \u003c(azd env get-values | grep AZURE_ENV_NAME)\n\necho \"building and deploying the streamlit user interface\"\nbash ./azd-hooks/deploy.sh sql-react $AZURE_ENV_NAME\n```\n\n## Starting up\n\n\n```\nconda create -n sqlagents python=3.12\n\nconda activate sqlagents\n\npython -m pip install -r requirements.txt   \n\npython -m streamlit run app.py --server.port=8000\n```\n\n\n## Startin up with open telemetry\n\n```\ndocker run --rm --name jaeger \\\n  -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \\\n  -p 6831:6831/udp \\\n  -p 6832:6832/udp \\\n  -p 5778:5778 \\\n  -p 16686:16686 \\\n  -p 4317:4317 \\\n  -p 4318:4318 \\\n  -p 14250:14250 \\\n  -p 14268:14268 \\\n  -p 14269:14269 \\\n  -p 9411:9411 \\\n  jaegertracing/all-in-one:1.60\n\nOTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317\n\nopentelemetry-instrument --service_name sql-ai-agent python -m streamlit run app.py --server.port=8000\n\nopen http://localhost:16686/search\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenniszielke%2Fsql-ai-agents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenniszielke%2Fsql-ai-agents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenniszielke%2Fsql-ai-agents/lists"}