How to make function calling responses better

I have implemented function calling with GPT-3.5-turbo model to call external APIs(chat completions API). But I wish to make it better. Let’s say I call a get_all_customers function which gets all the customerI wish to achieve the following:

  1. The bot should respond in the lines of “sure, here’s the list of customers” and then return the response. I’m hardcoding this right now.

  2. Let’s say the user wants the list of customers from India alone. The bot should return the customer data that has the country field as India(assumed that the function called returns all the customers data as list)

For example, Here I have a code to get all resources using a function call. I’m segregating currency and non-currency resources from the output manually. Can I make the bot do it?:

def get_all_resources_by_currency(isCurrency):
    url = (
        response = requests.get(
            url, headers={"Authorization": "Bearer " + bearer_token})
        if response.status_code == 200:
            resources = json.dumps(response.json(), indent=4)
            resources_json = json.loads(resources)
            data = resources_json
            resources_details = 'Sure. Here are the details of the resources:\n'

            for resource in data:
                if (isCurrency == True and resource['isCurrency'] == True) or (isCurrency == False and resource['isCurrency'] == False):
                    resources_details += f"\nName: {resource['name']}\n"
                    resources_details += f"Resource ID: {resource['resourceId']}\n"
                    resources_details += f"Currency: {resource['isCurrency']}\n"
                    resources_details += f"Currency Code: {resource.get('currencyCode', 'N/A')}\n"
                    resources_details += f"Currency Symbol: {resource.get('currencySymbol', 'N/A')}\n"
                    resources_details += f"Unit Of Measurement: {resource.get('unitofmeasurement', 'N/A')}\n"
                    resources_details += f"Ceiling: {resource['ceiling']}\n"
                    resources_details += f"Floor: {resource['floor']}\n"
                    resources_details += f"\n------------------------------------\n"
            return resources_details
            return []

    except requests.exceptions.RequestException as e:
        return "Apologies. Unable to process request. Please try again."

Is there a possibility that I can achieve this?