Closed csgulati09 closed 7 months ago
Based on the context you've provided, it seems you're trying to use a render
method in the Portkey Node SDK. However, from the information available in the repository, it's not clear if such a method exists.
If a render
method does exist, you would typically use it in a similar way to the completions.create
method you've already used. Here's an example:
async function useRenderMethod() {
try {
const response = await portkey.render({
prompt: "Your prompt here",
// Include other necessary parameters according to the SDK's documentation
});
console.log(response); // Adjust based on the expected response structure
} catch (error) {
console.error("Error using render method:", error);
}
}
useRenderMethod();
This example assumes the existence of a render
method on the Portkey client, which matches the pattern of your existing code. You'll need to replace "Your prompt here"
and possibly include other parameters based on the specific requirements of the render
method as defined in the Portkey SDK documentation. The try-catch block is used to handle any errors that might occur during the API call.
If the render
method does exist and is successfully called, the expected response structure, based on the provided context, is an object of type TextCompletion
. The TextCompletion
interface includes the fields id
, object
, created
, model
, choices
(an array of Choices
), and optionally usage
(of type Usage
).
In terms of error handling, the render
method might throw several specific error messages or exceptions that you should handle, including BadRequestError
, AuthenticationError
, PermissionDeniedError
, NotFoundError
, ConflictError
, UnprocessableEntityError
, RateLimitError
, InternalServerError
, APIUserAbortError
, APIConnectionError
, and APIConnectionTimeoutError
.
If the render
method does not exist in the Portkey Node SDK, you'll need to find an alternative way to achieve your goal. If you could provide more details about the issues you're encountering, I might be able to provide more specific guidance.
Enable support for prompt/render route