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

[Bug]: Gemini Function Calling raises "InternalServerError: 500 Internal error encountered" #284

Open
mehnoorsiddiqui opened this issue Mar 5, 2024 · 5 comments
Labels
type:bug Something isn't working

Comments

@mehnoorsiddiqui
Copy link

Description of the bug:

curl --location 'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key='myapikey \
--header 'Content-Type: application/json' \
--data '{
    "generationConfig": {
        "temperature": 0,
        "topP": 1
    },
    "tools": [
        {
            "functionDeclarations": [
                {
                    "name": "get_relevant_endpoints",
                    "parameters": {
                        "required": [
                            "endpoint_name"
                        ],
                        "properties": {
                            "endpoint_name": {
                                "type": "ARRAY",
                                "items": {
                                    "type": "STRING"
                                }
                            }
                        },
                        "type": "OBJECT"
                    },
                    "description": "Retrieve Endpoint names that will solve what the user is asking in the question"
                }
            ]
        }
    ],
    "contents": [
        {
            "parts": [
                {
                    "text": "You are Twitter API code sample generator for C#. You are provided with all the endpoints in the API with their \"Name\" as well as their \"Description\" at the end of this prompt.\r\nYour task is to identify a maximum of 6 endpoint names based on provided endpoint names and descriptions that will solve what the user is asking in the question.\r\nIn case you find that multiple endpoints serve the exact same purpose, pick the one that best matches the user'\''s need\r\n\r\nRemember while answering                              \r\n    * Only use the provided Endpoint Names and Descriptions; nothing else \r\n    * Only return the endpoint \"Name\"; nothing else\r\n\r\nIf the user'\''s question isn'\''t related to achieving a use case using the endpoints in the API below then Say this quote word by word \"Sorry I do not know\"    \r\nQuestion:  how can i find the last liked tweet?\r\nEndpoint Names and Descriptions: {\"Endpoints\":[{\"Name\":\"listTweetsLookup\",\"Description\":\"Returns a list of Tweets from the specified List.\"},{\"Name\":\"multipleTweetsLookup\",\"Description\":\"Returns a variety of information about the Tweet specified by the requested ID or list of IDs.\"},{\"Name\":\"createATweet\",\"Description\":\"Creates a Tweet on behalf of an authenticated user.\"},{\"Name\":\"fullArchiveTweetCounts\",\"Description\":\"Returns the count of Tweets that match your query from the complete history of public Tweets; since the first Tweet was created March 26, 2006.\"},{\"Name\":\"recentTweetCounts\",\"Description\":\"Returns count of Tweets from the last seven days that match a query.\"},{\"Name\":\"getTweetsFirehoseStream\",\"Description\":\"Streams 100% of public Posts.\"},{\"Name\":\"getTweetsFirehoseStreamLangEn\",\"Description\":\"Streams 100% of English Language public Posts.\"},{\"Name\":\"getTweetsFirehoseStreamLangJa\",\"Description\":\"Streams 100% of Japanese Language public Posts.\"},{\"Name\":\"getTweetsFirehoseStreamLangKo\",\"Description\":\"Streams 100% of Korean Language public Posts.\"},{\"Name\":\"getTweetsFirehoseStreamLangPt\",\"Description\":\"Streams 100% of Portuguese Language public Posts.\"},{\"Name\":\"sampleStream\",\"Description\":\"Streams a deterministic 1% of public Posts.\"},{\"Name\":\"getTweetsSample10Stream\",\"Description\":\"Streams a deterministic 10% of public Posts.\"},{\"Name\":\"full-ArchiveTweetsSearch\",\"Description\":\"Returns the complete history of public Tweets matching a search query; since the first Tweet was created March 26, 2006.\"},{\"Name\":\"recentTweetsSearch\",\"Description\":\"Returns Tweets from the last seven days that match a search query.\"},{\"Name\":\"searchStream\",\"Description\":\"Streams Tweets in real-time matching the stream'\''s active rule set.\"},{\"Name\":\"getRules\",\"Description\":\"Return either a single rule, or a list of rules that have been added to the stream, specified by the provided rule ids.\"},{\"Name\":\"addOrDeleteRulesToStream\",\"Description\":\"Add or delete rules to your stream from a User'\''s active rule set. Users can provide unique, optionally tagged rules to add. Users can delete their entire rule set or a subset specified by rule ids or values.\"},{\"Name\":\"deleteTweetById\",\"Description\":\"Delete specified Post (in the path) by ID.\"},{\"Name\":\"singleTweetLookup\",\"Description\":\"Returns a variety of information about a single Tweet specified by the requested ID.\"},{\"Name\":\"findTweetsThatQuoteATweet\",\"Description\":\"Returns a variety of information about each Tweet that quotes the Tweet specified by the requested ID.\"},{\"Name\":\"findTweetsThatRetweetATweet\",\"Description\":\"Returns the Retweets for a given Tweet ID.\"},{\"Name\":\"hideOrUnhideAReplyById\",\"Description\":\"Hides or unhides a reply to a Tweet.\"},{\"Name\":\"likedTweets\",\"Description\":\"Returns a list of Tweets that have been liked by a specified user ID\"},{\"Name\":\"LikeATweet\",\"Description\":\"Allows an authenticated user to like a Tweet.\"},{\"Name\":\"unlikeATweet\",\"Description\":\"Allows an authenticated user ID to unlike a Tweet.\"},{\"Name\":\"userMentionTimelineById\",\"Description\":\"Returns Post objects that mention username associated to the provided User ID\"},{\"Name\":\"retweetATweet\",\"Description\":\"Allows an authenticated user to Retweet a Tweet.\"},{\"Name\":\"undoARetweet\",\"Description\":\"Allows a user or authenticated user ID to remove the Retweet of a Tweet.\"},{\"Name\":\"reverseChronologicalHomeTimelineByID\",\"Description\":\"Allows you to retrieve a collection of the most recent Tweets and Retweets posted by you or a user you follow. This endpoint can return every Tweet created on a timeline over the last 7 days and the most recent 800 regardless of the creation date.\"},{\"Name\":\"userTweetTimelineByID\",\"Description\":\"Returns Tweets composed by a single user, specified by the requested user ID. By default, the most recent ten Tweets are returned per request. Using pagination, the most recent 3,200 Tweets can be retrieved.\"},{\"Name\":\"followerLookupList\",\"Description\":\"Returns follower details from the List specified by the requested ID\"},{\"Name\":\"listUserMemberships\",\"Description\":\"Returns details on Lists a user is a member of specified by the requested ID\"},{\"Name\":\"tweetsLikingUsers\",\"Description\":\"Returns a list of users who have liked a specified Tweet ID.\"},{\"Name\":\"getRetweetingUsersByTweetID\",\"Description\":\"Returns a list of users who have Retweeted a specified Tweet ID.\"},{\"Name\":\"findUsersById\",\"Description\":\"Returns a variety of information about one or more users specified by the requested IDs.\"},{\"Name\":\"findUsersByUsername\",\"Description\":\"Returns a variety of information about one or more users specified by their usernames.\"},{\"Name\":\"findUserByUsername\",\"Description\":\"Returns information about a User by username.\"},{\"Name\":\"authenticatedUserLookup\",\"Description\":\"Returns information about an authorized user.\"},{\"Name\":\"searchUserByQuery\",\"Description\":\"Returns Users that match a search query.\"},{\"Name\":\"findUserById\",\"Description\":\"Returns a variety of information about a single user specified by the requested ID.\"},{\"Name\":\"blocksLookup\",\"Description\":\"Returns a list of users who are blocked by the specified user ID.\"},{\"Name\":\"followersOfUserID\",\"Description\":\"Returns a list of Users who are followers of the specified User ID.\"},{\"Name\":\"usersAUserIdIsFollowing\",\"Description\":\"Returns a list of users the specified user ID is following.\"},{\"Name\":\"followAUserId\",\"Description\":\"Allows a user ID to follow another user. If the target user does not have public Tweets, this endpoint will send a follow request.\"},{\"Name\":\"listMutedUsersByUserID\",\"Description\":\"Returns a list of users who are muted by the specified user ID.\"},{\"Name\":\"muteAUserId\",\"Description\":\"Allows an authenticated user ID to mute the target user.\"},{\"Name\":\"unfollowAUserId\",\"Description\":\"Allows a user ID to unfollow another user. The request succeeds with no action when the authenticated user sends a request to a user they'\''re not following or have already unfollowed.\"},{\"Name\":\"unmuteAUserId\",\"Description\":\"Allows an authenticated user ID to unmute the target user. The request succeeds with no action when the user sends a request to a user they'\''re not muting or have already unmuted.\"},{\"Name\":\"getUsageTweets\",\"Description\":\"Returns the Tweets usage at a project and client app level\"},{\"Name\":\"getTrends\",\"Description\":\"Returns the Trend associated with the supplied where-on-earth ID (woeid) for a location.\"},{\"Name\":\"findSpacesByListOfIds\",\"Description\":\"Returns information about one or more Spaces with the specified comma-separated list of IDs. You can request up to 100 Spaces in a single request\"},{\"Name\":\"findSpacesCreatedByOneOrMoreUsers\",\"Description\":\"Returns live or scheduled Spaces created by the specified user IDs. Up to 100 comma-separated IDs can be looked up using this endpoint.\"},{\"Name\":\"searchSpacesByTitle\",\"Description\":\"Return live or scheduled Spaces matching your specified search terms. This endpoint performs a keyword search, meaning that it will return Spaces that are an exact case-insensitive match of the specified search term. The search term will match the original title of the Space.\"},{\"Name\":\"findSpacesBySingleId\",\"Description\":\"Returns a variety of information about a single Space specified by the requested ID.\"},{\"Name\":\"listUsersWhoBoughtATicketToASpace\",\"Description\":\"Returns a list of user who purchased a ticket to the requested Space.\"},{\"Name\":\"getSpaceTweets\",\"Description\":\"Returns Tweets shared in the requested Spaces.\"},{\"Name\":\"createNewGroupDMAndConversation\",\"Description\":\"Creates a new group conversation and adds a Direct Message to it on behalf of an authenticated user.\"},{\"Name\":\"getDMEventsByOneToOneConversation\",\"Description\":\"Returns a list of Direct Messages (DM) events within a 1-1 conversation with the user specified in the participant_id path parameter. Messages are returned in reverse chronological order.\"},{\"Name\":\"createAOneToOneDirectMessage\",\"Description\":\"Creates a one-to-one Direct Message and adds it to the one-to-one conversation. This method either creates a new one-to-one conversation or retrieves the current conversation and adds the Direct Message to it.\"},{\"Name\":\"AddDMToConversation\",\"Description\":\"Creates a direct message for a DM Conversation on behalf of an authenticated user specified by DM Conversation ID\"},{\"Name\":\"getDMsByConversation\",\"Description\":\"Returns a list of Direct Messages within a conversation specified in the dm_conversation_id path parameter. Messages are returned in reverse chronological order.\"},{\"Name\":\"getDMEventsByUser\",\"Description\":\"Returns a list of Direct Messages for the authenticated user, both sent and received. Direct Message events are returned in reverse chronological order. Supports retrieving events from the previous 30 days.\"},{\"Name\":\"getDMEventsById\",\"Description\":\"Returns DM Events by event id.\"},{\"Name\":\"createAList\",\"Description\":\"Enables the authenticated user to create a List.\"},{\"Name\":\"deleteAList\",\"Description\":\"Enables the authenticated user to delete a List that they own.\"},{\"Name\":\"listLookupByListId\",\"Description\":\"Returns the details of a specified List.\"},{\"Name\":\"updateAList\",\"Description\":\"Enables the authenticated user to update the meta data of a specified List that they own.\"},{\"Name\":\"addAListMember\",\"Description\":\"Enables the authenticated user to add a member to a List they own.\"},{\"Name\":\"removeAListMember\",\"Description\":\"Enables the authenticated user to remove a member from a List they own.\"},{\"Name\":\"getUserFollowedLists\",\"Description\":\"Returns all Lists a specified user follows.\"},{\"Name\":\"followAList\",\"Description\":\"Enables the authenticated user to follow a List.\"},{\"Name\":\"unfollowAList\",\"Description\":\"Enables the authenticated user to unfollow a List.\"},{\"Name\":\"getUserListMemberships\",\"Description\":\"Returns all Lists a specified user is a member of.\"},{\"Name\":\"listUserOwnedLists\",\"Description\":\"Returns all Lists owned by the specified user.\"},{\"Name\":\"listUserPinnedLists\",\"Description\":\"Returns the Lists pinned by a specified user.\"},{\"Name\":\"pinAList\",\"Description\":\"Enables the authenticated user to pin a List.\"},{\"Name\":\"unpinAList\",\"Description\":\"Enables the authenticated user to unpin a List.\"},{\"Name\":\"listBookmarkedTweets\",\"Description\":\"Returns a list of Tweets that have been bookmarked by a specified user ID.\"},{\"Name\":\"bookmarkATweet\",\"Description\":\"Allows an authenticated user to bookmark a tweet\"},{\"Name\":\"removeATweetBookmark\",\"Description\":\"Allows a user or authenticated user ID to remove a Bookmark of a Tweet.\"},{\"Name\":\"listAllBatchComplianceJobs\",\"Description\":\"Returns a list of recent compliance jobs for a given job type and optional job status\"},{\"Name\":\"createABatchComplianceJob\",\"Description\":\"Creates a new compliance job for Tweet IDs or user IDs. A compliance job will contain an ID and a destination URL. The destination URL represents the location that contains the list of IDs consumed by your App\"},{\"Name\":\"getAComplianceJobByID\",\"Description\":\"Get a single compliance job with the specified ID.\"},{\"Name\":\"getLikesComplianceStream\",\"Description\":\"Streams 100% of compliance data for Users\"},{\"Name\":\"getTweetsComplianceStream\",\"Description\":\"Connect to one of four partitiona of the Tweet compliance stream.\"},{\"Name\":\"getTweetsLabelStream\",\"Description\":\"Streams 100% of labeling events applied to Tweets\"},{\"Name\":\"getUsersComplianceStream\",\"Description\":\"Connect to one of four partitions of the User compliance stream.\"},{\"Name\":\"getOpenApiSpec\",\"Description\":\"Full OpenAPI Specification in JSON format. (See https://github.com/OAI/OpenAPI-Specification/blob/master/README.md)\"},{\"Name\":\"getRuleCount\",\"Description\":\"Returns the counts of rules from a User'\''s active rule set, to reflect usage by project and application.\"},{\"Name\":\"likesFirehoseStream\",\"Description\":\"Streams 100% of public Likes.\"},{\"Name\":\"likesSample10Stream\",\"Description\":\"Streams 10% of public Likes.\"}]}"
                }
            ],
            "role": "user"
        }
    ]
}'

Actual vs expected behavior:

Actual behavior
Sometimes the API response is 200 and sometimes 500

Expected behavior
Every time the API response must be 200

Any other information you'd like to share?

Previously this happened less frequently but now I am getting 500 after every 1 or 2 request

@mehnoorsiddiqui mehnoorsiddiqui added the type:bug Something isn't working label Mar 5, 2024
@gladkikhartem
Copy link

gladkikhartem commented Mar 5, 2024

I have same behavior periodically.
More importantly - I just sometimes receive empty response.
Specifically for requests for translating the text
"Candidates":[{"Index":0,"Content":null,"FinishReason":5,"SafetyRatings":null,"CitationMetadata":null,"TokenCount":0}],"PromptFeedback":{"BlockReason":0,"SafetyRatings":[{"Category":9,"Probability":1,"Blocked":false},{"Category":8,"Probability":1,"Blocked":false},{"Category":7,"Probability":1,"Blocked":false},{"Category":10,"Probability":1,"Blocked":false}]}}

@RHosono
Copy link

RHosono commented Jun 4, 2024

I have same behavior periodically. More importantly - I just sometimes receive empty response. Specifically for requests for translating the text "Candidates":[{"Index":0,"Content":null,"FinishReason":5,"SafetyRatings":null,"CitationMetadata":null,"TokenCount":0}],"PromptFeedback":{"BlockReason":0,"SafetyRatings":[{"Category":9,"Probability":1,"Blocked":false},{"Category":8,"Probability":1,"Blocked":false},{"Category":7,"Probability":1,"Blocked":false},{"Category":10,"Probability":1,"Blocked":false}]}}

Same for me with translations. Mostly in ES?

@bthanish
Copy link

Any update?

@PizBernina
Copy link

Same here. Function calling leads to InternalServerError: 500 every now and then.
gemini-1.5-pro-001

@danpe
Copy link

danpe commented Oct 17, 2024

Same here 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants