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

Changes to make OpenAI key work for dataStoreAgent #6

Merged
merged 4 commits into from
Oct 23, 2024

Conversation

gaganahluwalia
Copy link
Collaborator

Description

Right now DatastoreAgent is failing to create a Cypher Query when using OpenAI Key, so a change in the code is required to parse the relationship returned by the OpenAI

Changelog

  • This change involves changing the code inside semantic_layer_builder.py

@evpearce
Copy link
Collaborator

evpearce commented Oct 22, 2024

It seems like we might be fixing this later that we should be. Is the real problem not that OpenAI is outputting the nodes in the wrong format? in which case it would be better to fix the prompt that asks for the nodes and not just un-nest the nodes. Maybe we could provide an example of the format that we want in the prompt. This way switching between models would be more likely to work if we change it in the future.

Copy link
Collaborator

@hsauve-scottlogic hsauve-scottlogic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work Gagan! I've tried with mistral and it breaks:
Error during data retrieval: 'relType'
I wonder if we should comment out the code for mistral, rather than remove it, and leave a comment?

@gaganahluwalia
Copy link
Collaborator Author

gaganahluwalia commented Oct 23, 2024

It seems like we might be fixing this later that we should be. Is the real problem not that OpenAI is outputting the nodes in the wrong format? in which case it would be better to fix the prompt that asks for the nodes and not just un-nest the nodes. Maybe we could provide an example of the format that we want in the prompt. This way switching between models would be more likely to work if we change it in the future.

This was an easy update to get it working with the Open AI key. With our dataset we could be facing some different problem, so we don't know how it's going to behave with the ESG dataset, that's why I didn't want to tinker the prompting as we may have to change that for our project later on.

@evpearce
Copy link
Collaborator

It seems like we might be fixing this later that we should be. Is the real problem not that OpenAI is outputting the nodes in the wrong format? in which case it would be better to fix the prompt that asks for the nodes and not just un-nest the nodes. Maybe we could provide an example of the format that we want in the prompt. This way switching between models would be more likely to work if we change it in the future.

This was an easy update to get it working with the Open AI key. With our dataset we could be facing some different problem, so we don't know how it's going to behave with the ESG dataset, that's why I didn't want to tinker the prompting as we may have to change that for our project later on.

Okay, could you add a comment explaining that it's temporary code please and why. Also we should probably change the code somehow so that it works for Mistral, commented out code like Helene said would be alright for now.

Copy link
Collaborator

@hsauve-scottlogic hsauve-scottlogic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code works both with mistral and openai now, nice work!

@gaganahluwalia
Copy link
Collaborator Author

It seems like we might be fixing this later that we should be. Is the real problem not that OpenAI is outputting the nodes in the wrong format? in which case it would be better to fix the prompt that asks for the nodes and not just un-nest the nodes. Maybe we could provide an example of the format that we want in the prompt. This way switching between models would be more likely to work if we change it in the future.

This was an easy update to get it working with the Open AI key. With our dataset we could be facing some different problem, so we don't know how it's going to behave with the ESG dataset, that's why I didn't want to tinker the prompting as we may have to change that for our project later on.

Okay, could you add a comment explaining that it's temporary code please and why. Also we should probably change the code somehow so that it works for Mistral, commented out code like Helene said would be alright for now.

I have added a comment which tell what the change is and this is a temporary change and we should be changing it in future to have LLM return the same structure. For the rel type failure for Mistral, I had to make another change, which has also been commented. As of now the code is working for both OpenAI and Mistral.

@gaganahluwalia gaganahluwalia merged commit c9b4577 into main Oct 23, 2024
4 checks passed
@gaganahluwalia gaganahluwalia deleted the FS-67/Datastore-agent-with-OpenAI branch October 23, 2024 15:36
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

Successfully merging this pull request may close these issues.

3 participants