Calling registered model from TypeScript function

Hello,

I am creating a TypeScript function where I’d like to invoke a registered model. I’ve imported the model in question (chatQwen72b) as a resource:

I can invoke the Palantir-provided Llama model using LanguageModels.Llama_3_3_70b_Instruct.createGenericChatCompletion(), but I’m not able to figure out the equivalent for the registered model. It’s possible this is because it is missing an API name:

The model registration looks like this:

@ExternalSystems({ sources: [MySource] })
@ChatCompletion()
public async chatQwen72b(messages: FunctionsGenericChatCompletionRequestMessages, params: GenericCompletionParams): Promise<FunctionsGenericChatCompletionResponse> {
    // ...
}

@ChatCompletion() does not appear to accept an API name parameter.

What is the correct way to set this up?

Hi @haavard,

You are correct that you can’t call a registered model from a TypeScript function because it does not have an API name. Its not possible to give functions which implement interfaces API names at the moment.

The cleanest workaround would be to have an inner function which chatQwen72b calls, an annotate that inner function with the @Query decorator (with an API name). Then you do not need to duplicate source code – but you’ll use chatQwen72b in places that expect a functional interface to be implemented and the inner function in other functions repositories.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.