Hello,
First of all, thank you for your continuous improvements and for listening to user feedback. We appreciate the new features and updates.
However, I have noticed that some documentation, such as developer console, palantir APIs, and the use of language models in TypeScript, is outdated or inconsistent across different pages. This has caused confusion for our team.
For example, when trying to use GPT-4.1 Nano, the Model Catalog suggests the following code:
import { Function } from "@foundry/functions-api"
import { GPT_4_1_NANO } from "@foundry/models-api/language-models"
export class MyFunctions {
@Function()
public async createChatCompletion(userInput: string): Promise<string | undefined> {
const response = await GPT_4_1_NANO.createChatCompletion({
params: {
"temperature": 0,
"maxTokens": 1000,
},
messages: [{ role: "USER", contents: [{ text: userInput }], }],
});
return response.choices[0].message.content;
}
}
But after importing the resource, the left sidebar helper shows a different usage:
import * as Gpt41nano from "@foundry/languagemodelservice/models/gpt41nano";
const result = await Gpt41nano.createChatCompletion({messages, params});`
And in practice, the working code looks like this:
@Function()
@Uses({queries: [Gpt4o.createChatCompletion]})
public async functionName(userInput: string) : Promise<string> {
const response = await Gpt4o.createChatCompletion({
params: {
"temperature": 0,
"maxTokens": 1000,
},
messages: [{ role: "USER", content: userInput }, { role: "SYSTEM", content: systemPrompt }],
});
if ***(response.type === 'ok')***{
const responseContent = response.value.choices[0].message.content ?? "";
return this.removeHtmlTags(responseContent);
} else {
throw new UserFacingError(`ChatCompletion failed: ${response.error.value ?? "unknown error"}`);
}
Are there any plans to update and unify the documentation, especially for the language model APIs? Consistent and up-to-date documentation would be very helpful for builders.