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

Adding notebook for function calling with Elasticsearch #250

Merged
merged 11 commits into from
May 30, 2024

Conversation

ashishtiwari1993
Copy link
Contributor

Adding a notebook for integrating OpenAI function calling with Elasticsearch

Copy link

gitnotebooks bot commented May 29, 2024

Found 1 changed notebook. Review the changes at https://gitnotebooks.com/elastic/elasticsearch-labs/pull/250

"id": "6dc83930-89c0-465b-9002-e6aa0d3f5e6f",
"metadata": {},
"source": [
"### Generate Elasticsearch Query DSL based on user query"
Copy link
Member

Choose a reason for hiding this comment

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

Worth looking into few-shot prompting so you can provide examples on the types of queries you want it to return. This should increase consistency.

Copy link
Contributor Author

@ashishtiwari1993 ashishtiwari1993 May 30, 2024

Choose a reason for hiding this comment

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

Hi Joe, I think adding this suggestion as side note in the blog would be better. Indeed its great suggestion but performing NL query is one of the part. As I tested it working for most of the basic query i.e search, aggs. Let me know your thought.

Copy link
Member

Choose a reason for hiding this comment

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

sure! Likely it will work fine as is and yes mention in blog that we are relying on the model's own knowledge to generate the queries but we can increase reliability with few shot for more complex queries.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good input. Thanks Joe

"### Open AI\n",
"\n",
"`OPENAI_API_KEY`: Setup an [Open AI account and create a secret key](https://platform.openai.com/docs/quickstart). \n",
"`GPT_MODEL`: We’re going to use the `gpt-4-1106-vision-preview` model but you can check [here](https://platform.openai.com/docs/guides/function-calling) which model is being supported for function calling.\n",
Copy link
Member

Choose a reason for hiding this comment

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

worth using gpt-4o instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I was about to change this. Updating with gpt-4o.

@joemcelroy joemcelroy merged commit 405a22f into main May 30, 2024
2 of 5 checks passed
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.

2 participants