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

TextCompletion does not support echo=True + logprobs>0 #463

Closed
Manuscrit opened this issue Jul 17, 2024 · 4 comments
Closed

TextCompletion does not support echo=True + logprobs>0 #463

Manuscrit opened this issue Jul 17, 2024 · 4 comments
Assignees
Labels
bug Something isn't working triage

Comments

@Manuscrit
Copy link

What Happened?

TextCompletion does not support the use of echo=True + logprobs>0 at the same time.
Because the first value of the logprobs in that case is None and not a number. Pydantic check then fails.

FYI, using OpenAI API with davinci-002.

What Should Have Happened?

The None value is supported, Pydantic does not fail on check.

Relevant Code Snippet

    response = gateway.completions.create(
        model=model,
        prompt=prompt,
        max_tokens=max_tokens,
        temperature=temperature,
        top_p=top_p,
        n=n,
        echo=True,
        logprobs=1,
    )   
 def normal_create(
        self, model, prompt, stream, temperature, max_tokens, top_p, **kwargs
    ) -> TextCompletion:
        response = self.openai_client.with_raw_response.completions.create(
            model=model,
            prompt=prompt,
            stream=stream,
            temperature=temperature,
            max_tokens=max_tokens,
            top_p=top_p,
            **kwargs,
        )
        data = TextCompletion(**json.loads(response.text))
        data._headers = response.headers
        return data

Your Twitter/LinkedIn

No response

@Manuscrit Manuscrit added the bug Something isn't working label Jul 17, 2024
@vrushankportkey
Copy link
Collaborator

Thank you for raising the issue @Manuscrit and for the detailed code snippets - we'll take up the issue and push a fix for it,

@narengogi
Copy link
Collaborator

Fixing this on the python-sdk @Manuscrit
Portkey-AI/portkey-python-sdk#186

@narengogi
Copy link
Collaborator

Already works on the node sdk
cc: @csgulati09

@vrushankportkey
Copy link
Collaborator

Done across the board, thank you so much @Manuscrit! Closing the issue as it's resolved now.

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

No branches or pull requests

3 participants