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

Can we ensure the ai to not use any other data not in the context? #30

Open
Ranork opened this issue Dec 19, 2023 · 2 comments
Open

Can we ensure the ai to not use any other data not in the context? #30

Ranork opened this issue Dec 19, 2023 · 2 comments
Labels
component:other Questions unrelated to SDK type:help Support-related issues

Comments

@Ranork
Copy link

Ranork commented Dec 19, 2023

We are trying to make a sql query generator with chat complation.

prompt: Show me the customers

history:

[
  {"role": "user", "parts": "### SYSTEM CONTEXT ### \nYou are an *MSSQL* command generator. Use table schema for generating sql commands. ### EXAMPLE RESONSE ### \`\`\`sql ... \`\`\`  \n ### DATABASE SCHEME ### ......."},
  {"role": "model", "parts": "OK" }
]
const gemini = gai.getGenerativeModel({ model });
const chat = gemini.startChat({history, generationConfig: { temperature: 0.2 }});

const result = await chat.sendMessage(prompt);
const response = await result.response;

It gives me cool sql commands but some table names are not logical names (like crnt_tbl for current table). AI tries to access tables that do not exist in the schema, causing the query to not work.

I want it to only use existing table names in the schema. How can I set this up?

@marb2000
Copy link

Prompt engineering for large language models is challenging. It involves providing clear context, specifying desired outcomes, and filtering unwanted outputs. Finding the perfect formula takes experimentation – playing with keywords, sentence structures, and prompt lengths.

I hope someone in the community can share their prompts that successfully tackled similar scenarios. In the meantime, this document helped me understand some best practices for prompt engineering

@marb2000 marb2000 added the status: awaiting user response Awaiting a response from the author label Dec 19, 2023
@Ranork
Copy link
Author

Ranork commented Dec 19, 2023

We have done these experiments on other artificial intelligence models, but it would be great if anyone who has solved similar situations could share their prompt formats :)
Thanks for fast answer!

@hsubox76 hsubox76 added type:help Support-related issues component:other Questions unrelated to SDK and removed status: awaiting user response Awaiting a response from the author labels Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:other Questions unrelated to SDK type:help Support-related issues
Projects
None yet
Development

No branches or pull requests

3 participants