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

support for gemini thinking model #856

Merged

Conversation

narengogi
Copy link
Collaborator

@narengogi narengogi commented Jan 6, 2025

Description: (optional)

  • Two cases:
  1. x-portkey-strict-open-ai-complaince: false the Chain of Thought message is included in the response and separated with \r\n\r\n
    example:
{
    "id": "portkey-2b003c25-7379-4620-a6f0-0b0ba3bc5d51",
    "object": "chat_completion",
    "created": 1736168989,
    "model": "Unknown",
    "provider": "vertex-ai",
    "choices": [
        {
            "message": {
                "role": "assistant",
                "content": "The user is continuing the pattern of simple arithmetic questions, building upon the previous answer.  They are asking for the product of 4 multiplied by itself. I need to perform this multiplication.\r\n\r\nFollowing that same line of thought, 4 * 4 = 16\n"
            },
            "index": 0,
            "finish_reason": "STOP"
        }
    ],
    "usage": {
        "prompt_tokens": 57,
        "completion_tokens": 55,
        "total_tokens": 112
    }
}

  1. x-portkey-strict-open-ai-complaince: true only the response is sent, not the CoT message
{
    "id": "portkey-099083cc-2ced-4d5d-8e87-a133d1ac51c2",
    "object": "chat_completion",
    "created": 1736168868,
    "model": "Unknown",
    "provider": "vertex-ai",
    "choices": [
        {
            "message": {
                "role": "assistant",
                "content": "Following that line of thought, 4 * 4 = 16\n"
            },
            "index": 0,
            "finish_reason": "STOP"
        }
    ],
    "usage": {
        "prompt_tokens": 57,
        "completion_tokens": 69,
        "total_tokens": 126
    }
}

Motivation: (optional)

  • Why this change is necessary or beneficial

Related Issues: (optional)

@pedroallenrevez
Copy link

any news on this?

@narengogi
Copy link
Collaborator Author

Added support for streaming response transforms as well

@VisargD VisargD merged commit b8f8753 into Portkey-AI:main Jan 18, 2025
2 checks passed
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

Successfully merging this pull request may close these issues.

3 participants