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

Get index mapping and Get reference document are inconsistent with noteboook in "OpenAI function calling with Elasticsearch" #267

Closed
liu-xiao-guo opened this issue Jun 8, 2024 · 2 comments
Assignees

Comments

@liu-xiao-guo
Copy link

I read through the blog at https://www.elastic.co/search-labs/blog/function-calling-with-elastic, and I found two functions defined in the notebook and blog are insconsistent:

  • def get_index_mapping():
  • get_ref_document()

The ones defined in the blogs are not correct:

def get_index_mapping():

    url = f"""{ES_ENDPOINT}/{ES_INDEX}/_mappings"""

    headers = {
        "Content-type": "application/json",
        "Authorization": f"""ApiKey {ES_API_KEY}""",
    }

def get_index_mapping():

    url = f"""{ES_ENDPOINT}/{ES_INDEX}/_mappings"""

    headers = {
        "Content-type": "application/json",
        "Authorization": f"""ApiKey {ES_API_KEY}""",
    }

    resp = requests.request("GET", url, headers=headers)
    resp = json.loads(resp.text)
    mapping = json.dumps(resp, indent=4)

    return mapping

The correct ones are shown in the attached pictures,
image
image

@ashishtiwari1993 ashishtiwari1993 self-assigned this Jun 10, 2024
@ashishtiwari1993
Copy link
Contributor

@ashishtiwari1993
Copy link
Contributor

Merged. Thanks @liu-xiao-guo for pointing this.

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

2 participants