1

Is there some API that would tell me Taylor Swift is an american singer, Jil Sander is a german brand and Mallard is a bird?

The closest I can find is Google's Knowledge Graph Search API, but according to it,

  • Taylor Swift, while indeed a Person and even a Thing, is most importantly a performer, which this response doesn't tell me.

    "itemListElement": [
        {
            "@type": "EntitySearchResult",
            "resultScore": 3186.92236328125,
            "result": {
            "@type": [
                "Thing",
                "Person"
            ],
                "detailedDescription": {
                "url": "https://en.wikipedia.org/wiki/Taylor_Swift",
                    "license": "https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License",
                    "articleBody": "Taylor Alison Swift is an American singer-songwriter. Her narrative songwriting, which is often inspired by her personal life, has received widespread media coverage and critical praise. "
                },
                "description": "American singer-songwriter",
                "@id": "kg:/m/0dl567",
                "name": "Taylor Swift",
                "url": "http://www.taylorswift.com/"
            }
        }
    ]
    
  • Jil Sander that I may be looking for is a Brand, not a Person or a Thing

    "itemListElement": [
        {
            "resultScore": 7223.4814453125,
            "@type": "EntitySearchResult",
            "result": {
            "description": "German fashion designer",
                "@id": "kg:/m/044jy_",
                "@type": [
                "Thing",
                "Person"
            ],
                "name": "Jil Sander",
                "detailedDescription": {
                "url": "https://en.wikipedia.org/wiki/Jil_Sander",
                    "license": "https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License",
                    "articleBody": "Heidemarie Jiline \"Jil\" Sander is a minimalist German fashion designer and the founder of the Jil Sander fashion house."
                }
            }
        }
    ]
    
  • It seems the best schema.org can do for a Mallard is label it as a Thing, not a Bird or even an Animal. It does say Birds under description, but that seems arbitrary, and I probably shouldn't trust it'll aways be there.

    "itemListElement": [
        {
            "resultScore": 135.50239562988281,
            "result": {
            "@id": "kg:/m/01hjj1",
                "@type": [
                "Thing"
            ],
                "detailedDescription": {
                "articleBody": "The mallard or wild duck is a dabbling duck that breeds throughout the temperate and subtropical Americas, Eurasia, and North Africa, and has been introduced to New Zealand, Australia, Peru, Brazil, Uruguay, Argentina, Chile, Colombia, the Falkland Islands, and South Africa. ",
                    "license": "https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License",
                    "url": "https://en.wikipedia.org/wiki/Mallard"
                },
                "description": "Birds",
                "name": "Mallard"
            },
            "@type": "EntitySearchResult"
        }
    ]
    
  • And for Mads Nørgaard it doesn't even know this Brand exists, although Google does have an information card on the right hand side of the corresponding search results page.

(Schema.org isn't a requirement, I referred to it because Google uses it in their responses.)

I can kind of deduce the pieces I'm looking for from the above responses, but that requires a human or a neural network, and I was hoping for an external API instead.

Thank you!

1 Answer 1

0

I think since 2020 you can call the REST API of any Large Language Model (LLM), e.g. ChatGPT (or a predecessor like GPT-3, and ask questions like that to get a reasonalble answer. Here is a API reference page and here is an REST API call and answer:

Question : Who is Taylor Swift?

Endpoint: https://api.openai.com/v1/chat/completions

JSON Message body for HTTP POST request

{
    "model": "gpt-3.5-turbo-0301",
    "messages": [
        {
            "role": "system",
            "content": "You are a helpful assistant"
        },
        {
            "role": "user",
            "content": "Who is Taylor Swift?"
        }
    ]
}

Answer / Response by ChatGPT

{
    "id": "chatcmpl-7Ji3UPI3w5OyauKduHiToEhcbFFdh",
    "object": "chat.completion",
    "created": 1684931936,
    "model": "gpt-3.5-turbo-0301",
    "usage": {
        "prompt_tokens": 23,
        "completion_tokens": 77,
        "total_tokens": 100
    },
    "choices": [
        {
            "message": {
                "role": "assistant",
                "content": "Taylor Swift is a famous American singer-songwriter known for her country and pop music. She first gained fame in 2006 with her debut album, and has since become a global music superstar with numerous hit songs, awards, and sold-out tours. Swift is also recognized for being an advocate for various social and political causes, and using her platform to raise awareness and inspire positive change."
            },
            "finish_reason": "stop",
            "index": 0
        }
    ]
}

Many of these LLMs have a free Tier, or you can start yout with a few dollars of free credit, after registration.

It is important to add your API key into a custom HTTP header. This will look like this: Authorization: Bearer sk-lB2b.................

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.