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

TypeValidationError - Seems like if there are issue with OpenAI, it is still trying to call chat completion and giving type error #344

Open
lcsvcn opened this issue Jun 3, 2024 · 0 comments

Comments

@lcsvcn
Copy link

lcsvcn commented Jun 3, 2024

Type validation failed: Value: {"error":{"message":"The server had an error processing your request. Sorry about that! You can retry your request, or contact us through our help center at help.openai.com if you keep seeing this error.","type":"server...

Error at text-chunk: Type validation failed: Value: {"error":{"message":"The server had an error processing your request. Sorry about that! You can retry your request, or contact us through our help center at help.openai.com if you keep seeing this error.","type":"server_error","param":null,"code":null}}.
Error message: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [
      "object"
    ],
    "message": "Required"
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [
      "id"
    ],
    "message": "Required"
  },
  {
    "code": "invalid_type",
    "expected": "array",
    "received": "undefined",
    "path": [
      "choices"
    ],
    "message": "Required"
  },
  {
    "code": "invalid_type",
    "expected": "number",
    "received": "undefined",
    "path": [
      "created"
    ],
    "message": "Required"
  }
]

The part of code that is being reported to have that issue on Sentry:

modelfusion/packages/modelfusion/dist/index.cjs in safeValidateTypes at line 1046:14

try {
    const validationResult = schema.validate(value);
    if (validationResult.success) {
      return validationResult;
    }
    return {
      success: false,
      error: new TypeValidationError({
        value,
        cause: validationResult.error  // THIS LINE THAT GIVES ERROR
      })
    };
  } catch (error) {
    return {
      success: false,

This is how I am calling in my code:

     const textStream = await streamText({
        model: openai.ChatTextGenerator({
          model: model,
          temperature: temperature,
          maxGenerationTokens: maxGenerationTokens,
        }),

        //@ts-ignore
        prompt: promptChat,
      })

I am using gpt4o model (supported in my PR), temperature 0.7, maxGenerationTokens 500

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

No branches or pull requests

1 participant