Skip to content

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

Closed
@liu-xiao-guo

Description

@liu-xiao-guo

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions