René's URL Explorer Experiment


Title: need scalar queries to work - stuck - help please · Issue #160 · Azure-Samples/rag-postgres-openai-python · GitHub

Open Graph Title: need scalar queries to work - stuck - help please · Issue #160 · Azure-Samples/rag-postgres-openai-python

X Title: need scalar queries to work - stuck - help please · Issue #160 · Azure-Samples/rag-postgres-openai-python

Description: @pamelafox I have been trying for a few days to adapt the system to work with my data - a single table of items - let's say they are cars I have modified following the guidance in customizing_data.md and the other data branch. I have loo...

Open Graph Description: @pamelafox I have been trying for a few days to adapt the system to work with my data - a single table of items - let's say they are cars I have modified following the guidance in customizing_data....

X Description: @pamelafox I have been trying for a few days to adapt the system to work with my data - a single table of items - let's say they are cars I have modified following the guidance in customizing_d...

Opengraph URL: https://github.com/Azure-Samples/rag-postgres-openai-python/issues/160

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"need scalar queries to work - stuck - help please","articleBody":"@pamelafox \nI have been trying for a few days to adapt the system to work with my data - a single table of items - let's say they are cars\n\nI have modified following the guidance in customizing_data.md and the other data branch. I have looked through other branches, am just not having any luck - example queries, few shot, answer.txt, query.txt and searcher examples below.\n\nI am really not sure where the structured logic of things like queries and creating a ton of functions to handle the possible query types - and how much to rely on the prompts to do things. For instance, when I ask for a list of something I tend to get 3 full car descriptions. I realize the 3 is probably being set in the developer settings.\n\nGuidance here would be greatly appreciated! I realize this project is 5 months old and as an ex-microsoftee, I know you are moving ahead at full speed, but I have found this template extremely helpful in accelerating my client's embracing AI and Azure for all AI related workloads. (I fully understand this is not intended for production use, but it has many best practices built into the solution.\n\nSpecifically, I would like to know:\n\nwhat is the extent of the power of the prompts, what aspects of system behavior should I lean on them for (see below)\nhow much should I be modifying QueryRewriter and PostgresSearcher, how generic should those changes be (see below)\nexactly what components in the FrontEnd need to be modified to handle different response types - say lists, citations under each response in a field that toggles visibility like in a file browser.\nExamples of what I have been trying - all at the same time - app runs and deploys file rarely crashes on a query. \n\ntrying to do is get support for queries like:\n\nQ: how many 1989 Ford's do we have? I want the answer to be something like\n\nA: we have 12 Ford cars in inventory \n- follow up question would you like to see a list of all of the?\n\nQ: Which is the range of reliability ratings?\nA: The cars in inventory range from 3 to 4.5 safety ratings\n- follow up would you like to see a list of them sorted by rating?\n\nQ: of the different manufacturers, which is the most popular?\nA: the Subaru Outback is the most popular, using the formula of the sum of the count of the number of votes for each star rating (1-5) /the number of votes \nQ: what adjective word occurs the most in the comments section\nA: happy was mentioned in 20 out of 120 reviews\n\nI have tried modified the following:\n\nQueryRewriter Updates - a bunch like this\n\n                    \"select\": {\n                        \"type\": \"object\",\n                        \"description\": \"Specify scalar operations like COUNT, AVG, etc.\",\n                        \"properties\": {\n                            \"operation\": {\n                                \"type\": \"string\",\n                                \"enum\": [\"COUNT\", \"AVG\", \"SUM\", \"MIN\", \"MAX\"],\n                                \"description\": \"The scalar operation to perform\",\n                            },\n                            \"field\": {\n                                \"type\": \"string\",\n                                \"description\": \"The field to operate on, e.g. '*' for COUNT(*) or 'metrics-\u003e\u003e'Views'' for views\",\n                            },\n                        },\n                        \"required\": [\"operation\", \"field\"],\n                    },\nPostgresSearcher Updates:\n\nImplement scalar operations for numeric metrics\nAdd type coercion for mixed string/number metrics\nExample query: metrics-\u003e\u003e'Views'::numeric for consistent numeric handling\nQueryRewriter Updates\n\nAdd metric name patterns to query generation\nHandle numeric comparisons in natural language\nUpdate few-shot with entries like\n{\n        \"role\": \"user\",\n        \"content\": \"how many Ford cars do we have?\"\n    },\n    {\n        \"role\": \"assistant\",\n        \"tool_calls\": [{\n            \"function\": {\n                \"name\": \"search_database\",\n                \"arguments\": {\n                    \"return_scalar\": {\n                        \"type\": \"count\",\n                        \"expression\": \"*\"\n                    },\n                    \"filters\": {\n                        \"Brand\": \"ig\",\n                        \"category\": \"cars\"\n                    }\n                }\n            }\n        }]\n    }\nAnswers.txt\n\nAssistant helps users find relevant cars and trucks.\nRespond as if you are a knowledgeable content curator. Do NOT respond with tables.\nAnswer ONLY with the content details listed in the sources.\nIf there isn't enough information below, say you don't know.\nDo not generate answers that don't use the sources below.\n\nFor scalar query results i.e. how many, highest rating, (like COUNT, AVG, etc):\n- Look for the metrics.scalar_result field which contains the actual numeric value\n- Present the value clearly and directly in a complete sentence\n- Include the [scalar_result] citation\nquery.txt\n\nYou are a query generator that helps translate natural language questions into search queries or scalar operations.\n\nFor scalar operations (like counting, averaging, finding max/min), generate a scalar operation with:\n\nselect_expr: The expression to compute (e.g. MAX, COUNT, AVG)\ngroup_by: Optional list of columns to group by\norder_by: Optional list of columns to order by\nfilters: List of filters to apply\nExamples:\n\n\"How many Ford cars are there?\" -\u003e COUNT(*) with brand = 'ford' and category='car'\n\"What vehicle has the most likes?\" -\u003e MAX((metrics-\u003e\u003e'Likes')::numeric)\n\"Average price of Subarus?\" -\u003e AVG((metrics-\u003e\u003e'price')::numeric) with brand = 'subaru'\nFor regular search queries, generate a search query based on the conversation.\nIf the question is not in English, translate it to English before generating the query.\n\nIf you cannot generate a search query, return the original user question.\n\nBelow is a history of the conversation so far, and a new question asked by the user that needs to be answered by searching database rows.\nYou have access to an Azure PostgreSQL database with a posts table that has the following columns:\n\nText fields: model, brand, category, description\nArrays: reviews, stars, features\nJSON fields: ownership_records (containing key value pairs of owner_name, puchase_date, Purchase_location, sale_date, sale_location )\nFor questions asking about counts, averages, sums, or other aggregate metrics:\n\nUse the \"select\" operation with COUNT, AVG, SUM, etc.\nExample: \"how many Subaru wagons? are in stock\" -\u003e use COUNT(*) with brand=\"subaru\" and category= \"wagon\"\nExample: \"average rating of fords?\" -\u003e use AVG(metrics-\u003e\u003e'rating') with brand=\"ford\"\nYou can combine with filters like channel, date ranges, etc.\n","author":{"url":"https://github.com/nickknyc","@type":"Person","name":"nickknyc"},"datePublished":"2025-02-04T18:09:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/160/rag-postgres-openai-python/issues/160"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:804b4ab6-8ba2-e5ba-b0be-d1f0a0021fd7
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9D66:AAFC3:5EF0B6:7F00D0:6A4C3B30
html-safe-nonce3b5475370f5943d118a18f7683a3fa195b88bf4038f5f4175898585ce4c34421
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDY2OkFBRkMzOjVFRjBCNjo3RjAwRDA6NkE0QzNCMzAiLCJ2aXNpdG9yX2lkIjoiNjQwMzUwNDk2NDAyNzMwMDY1NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacca7accc4569e297467b73b6d18c1481ffd5b43ed013b7ec8836216df4ac7fe1d
hovercard-subject-tagissue:2830962399
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/Azure-Samples/rag-postgres-openai-python/160/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2a7cee8a6214a152cd669371f909b1bcdc47e8b4f045768ea44e984cd26a1c59/Azure-Samples/rag-postgres-openai-python/issues/160
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2a7cee8a6214a152cd669371f909b1bcdc47e8b4f045768ea44e984cd26a1c59/Azure-Samples/rag-postgres-openai-python/issues/160
og:image:alt@pamelafox I have been trying for a few days to adapt the system to work with my data - a single table of items - let's say they are cars I have modified following the guidance in customizing_data....
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamenickknyc
hostnamegithub.com
expected-hostnamegithub.com
None1b6b16d04026f131a36d57e3b01d0f4d26a51800edf48bf5ed0256e0ac905511
turbo-cache-controlno-preview
go-importgithub.com/Azure-Samples/rag-postgres-openai-python git https://github.com/Azure-Samples/rag-postgres-openai-python.git
octolytics-dimension-user_id1844662
octolytics-dimension-user_loginAzure-Samples
octolytics-dimension-repository_id800643890
octolytics-dimension-repository_nwoAzure-Samples/rag-postgres-openai-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id800643890
octolytics-dimension-repository_network_root_nwoAzure-Samples/rag-postgres-openai-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
released11deab54ce15bac57bda991cc63805976812c11
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/Azure-Samples/rag-postgres-openai-python/issues/160#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FAzure-Samples%2Frag-postgres-openai-python%2Fissues%2F160
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FAzure-Samples%2Frag-postgres-openai-python%2Fissues%2F160
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=Azure-Samples%2Frag-postgres-openai-python
Reloadhttps://github.com/Azure-Samples/rag-postgres-openai-python/issues/160
Reloadhttps://github.com/Azure-Samples/rag-postgres-openai-python/issues/160
Reloadhttps://github.com/Azure-Samples/rag-postgres-openai-python/issues/160
Please reload this pagehttps://github.com/Azure-Samples/rag-postgres-openai-python/issues/160
Azure-Samples https://github.com/Azure-Samples
rag-postgres-openai-pythonhttps://github.com/Azure-Samples/rag-postgres-openai-python
Notifications https://github.com/login?return_to=%2FAzure-Samples%2Frag-postgres-openai-python
Fork 1.1k https://github.com/login?return_to=%2FAzure-Samples%2Frag-postgres-openai-python
Star 496 https://github.com/login?return_to=%2FAzure-Samples%2Frag-postgres-openai-python
Code https://github.com/Azure-Samples/rag-postgres-openai-python
Issues 20 https://github.com/Azure-Samples/rag-postgres-openai-python/issues
Pull requests 19 https://github.com/Azure-Samples/rag-postgres-openai-python/pulls
Actions https://github.com/Azure-Samples/rag-postgres-openai-python/actions
Security and quality 0 https://github.com/Azure-Samples/rag-postgres-openai-python/security
Insights https://github.com/Azure-Samples/rag-postgres-openai-python/pulse
Code https://github.com/Azure-Samples/rag-postgres-openai-python
Issues https://github.com/Azure-Samples/rag-postgres-openai-python/issues
Pull requests https://github.com/Azure-Samples/rag-postgres-openai-python/pulls
Actions https://github.com/Azure-Samples/rag-postgres-openai-python/actions
Security and quality https://github.com/Azure-Samples/rag-postgres-openai-python/security
Insights https://github.com/Azure-Samples/rag-postgres-openai-python/pulse
need scalar queries to work - stuck - help pleasehttps://github.com/Azure-Samples/rag-postgres-openai-python/issues/160#top
https://github.com/nickknyc
nickknychttps://github.com/nickknyc
on Feb 4, 2025https://github.com/Azure-Samples/rag-postgres-openai-python/issues/160#issue-2830962399
@pamelafoxhttps://github.com/pamelafox
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.