feat: suggest dataservice description#924
Conversation
550dbdb to
df4c507
Compare
| + `Here is the API information:\n` | ||
| + `Title: ${title.trim()}\n` | ||
| + (hasTechnical ? `Technical documentation URL: ${technicalDocumentationUrl.trim()}\n` : '') | ||
| + (hasMachine ? `Machine documentation URL (OpenAPI/Swagger): ${machineDocumentationUrl.trim()}\n` : '') |
There was a problem hiding this comment.
Design: The openweight-small model can't browse these URLs — it only sees the URL strings. The prompt asks to "mention key endpoints, data types, and use cases" but the model has no access to the actual documentation content. This will likely produce hallucinated descriptions about specific endpoints.
Possible alternatives:
- Fetch the documentation content server-side and include it in the prompt
- Use
createAgentCompletionif the Albert agent API supports web browsing - Adjust the prompt to only describe what can be reasonably inferred from a title + URL patterns
There was a problem hiding this comment.
Damned I was tricked by the hallucinations of the models who made me think it was indeed browsing the URLs! Good call.
I would go for option 1, trying to fetch and format the data from those URLs, with some guardrails regarding the maximum size of the prompt and what those models should/could have as a long prompt. I'll suggest a commit soon.
7c4bf25 to
3c20ce2
Compare
494af3c to
ba1f4fa
Compare
ba1f4fa to
d99abad
Compare
Remove explicit ref import as it's auto-imported by Nuxt Co-authored-by: Cursor <cursoragent@cursor.com>
- Use callAlbertAPI from albert-helpers in generate-dataservice-description (align with other Albert endpoints) - Fix 422 for 'description too short' so it is returned to client instead of 500 - Remove validateAlbertConfig; useAlbertConfig() already throws when API key is missing - Drop redundant error logging in dataservice-description handler Co-authored-by: Cursor <cursoragent@cursor.com>
…ateDescriptionFeedbackUrl Co-authored-by: Cursor <cursoragent@cursor.com>
d99abad to
86cfec4
Compare
…vice documentation
Made-with: Cursor
Made-with: Cursor
98d8896 to
f02323a
Compare
f02323a to
4ca3fb9
Compare
ThibaudDauce
left a comment
There was a problem hiding this comment.
Thanks! Really sorry for the delay :-(
| let technicalContent = '' | ||
| let machineContent = '' | ||
|
|
||
| const fetchPromises: Promise<void>[] = [] | ||
| if (technicalUrl) { | ||
| fetchPromises.push( | ||
| fetchDocumentationContent(technicalUrl) | ||
| .then((content) => { technicalContent = content }) | ||
| .catch((err) => { | ||
| throw createError({ | ||
| statusCode: 422, | ||
| statusMessage: err instanceof Error ? err.message : 'Failed to load technical documentation URL.', | ||
| }) | ||
| }), | ||
| ) | ||
| } | ||
| if (machineUrl) { | ||
| fetchPromises.push( | ||
| fetchDocumentationContent(machineUrl) | ||
| .then((content) => { machineContent = content }) | ||
| .catch((err) => { | ||
| throw createError({ | ||
| statusCode: 422, | ||
| statusMessage: err instanceof Error ? err.message : 'Failed to load machine documentation URL.', | ||
| }) | ||
| }), | ||
| ) | ||
| } | ||
|
|
||
| await Promise.all(fetchPromises) |
There was a problem hiding this comment.
Could be directly a Promise.all(), no?
| let technicalContent = '' | |
| let machineContent = '' | |
| const fetchPromises: Promise<void>[] = [] | |
| if (technicalUrl) { | |
| fetchPromises.push( | |
| fetchDocumentationContent(technicalUrl) | |
| .then((content) => { technicalContent = content }) | |
| .catch((err) => { | |
| throw createError({ | |
| statusCode: 422, | |
| statusMessage: err instanceof Error ? err.message : 'Failed to load technical documentation URL.', | |
| }) | |
| }), | |
| ) | |
| } | |
| if (machineUrl) { | |
| fetchPromises.push( | |
| fetchDocumentationContent(machineUrl) | |
| .then((content) => { machineContent = content }) | |
| .catch((err) => { | |
| throw createError({ | |
| statusCode: 422, | |
| statusMessage: err instanceof Error ? err.message : 'Failed to load machine documentation URL.', | |
| }) | |
| }), | |
| ) | |
| } | |
| await Promise.all(fetchPromises) | |
| async function fetchOrFail(url: string, label: string): Promise<string> { | |
| if (!url) return '' | |
| try { | |
| return await fetchDocumentationContent(url) | |
| } | |
| catch (err) { | |
| throw createError({ | |
| statusCode: 422, | |
| statusMessage: err instanceof Error ? err.message : `Failed to load ${label} documentation URL.`, | |
| }) | |
| } | |
| } | |
| const [technicalContent, machineContent] = await Promise.all([ | |
| fetchOrFail(technicalUrl, 'technical'), | |
| fetchOrFail(machineUrl, 'machine'), | |
| ]) |
Add AI-powered description suggestion for dataservices (external APIs) via the Albert API.
When editing a dataservice, a "Suggérer une description" button generates a French description. The button is enabled only when:
Changes:
titleand at least one oftechnicalDocumentationUrlormachineDocumentationUrlEDIT (2026-02-17):
callAlbertAPI(albert-helpers), same pattern as other Albert endpoints.fetch-documentation.ts: HTML stripped, JSON/YAML as-is, 15s timeout, 120k char cap). Previously only the URLs were sent.validateAlbertConfigfrom helper and all Albert endpoints.