Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[smart-shop-agent-alloydb] #1426

Open
msanaulla opened this issue Sep 6, 2024 · 0 comments
Open

[smart-shop-agent-alloydb] #1426

msanaulla opened this issue Sep 6, 2024 · 0 comments

Comments

@msanaulla
Copy link

In this query:

select id, description, LLM_RESPONSE from (
SELECT id, user_text, description, category, sub_category, uri,
ML_PREDICT_ROW(
'projects/abis-345004/locations/us-central1/publishers/google/models/text-bison',
    json_build_object(
        'instances', json_build_array(
            json_build_object(
                'prompt', 'Read this user search text: ' || user_text || ' Compare it against the product record: ' || content || ' Return a response with 3 values: 1) MATCH: if the 2 products are at least 85% matching or not: YES or NO 2) PERCENTAGE: percentage of match, make sure that this percentage is accurate 3) DIFFERENCE: A clear short easy description of the difference between the 2 products. Remember if the user search text says that some attribute should not be there, and the product record has it, it should be a NO match.'
            )
        ),
        'parameters', json_build_object(
            'maxOutputTokens', 1024,
            'topK', 40,
            'topP', 0.8,
            'temperature', 0.2
        )
    )
) -> 'predictions' -> 0 -> 'content' AS LLM_RESPONSE
FROM  (
SELECT 'I want womens footwear, black color, with heels and strictly no leather.' user_text, id, category, sub_category, uri, content, pdt_desc  as description FROM apparels
ORDER BY embedding <=> embedding('textembedding-gecko@003', 'I want womens footwear, black color, with heels and strictly no leather.')::vector LIMIT 25) as xyz
) as X
where cast(LLM_RESPONSE as VARCHAR(500)) like '%MATCH:%YES%' limit 10;

For The URL: projects/abis-345004/locations/us-central1/publishers/google/models/text-bison we need to mention the reader to replace abis-345004 with their project id.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant