Tanto rumore, tanta strada da fare


Il lettore minimamente interessato di tecnologia non potrà non aver sentito parlare di Chat Generative Pre-trained Transformer, ChatGPT, un cosiddetto “chatbot” balzato agli onori della cronaca da poche settimane per la sua prodigiosa “intelligenza”, se così vogliamo dire.
In questo articolo racconterò di un paio di interessanti avventure con questo sistema senza soffermarmi troppo sulle basi, chi avesse bisogno di una infarinatura, invece, può leggere l’articolo su Wikipedia oppure guardare l’ottimo video di Matteo Flora .

Oltre ad avere impressionati capacità di conversazione, ChatGPT è noto per dare anche consulenza (pareri, suggerimenti, chiamateli come volete) professionale, è inoltre in grado di scrivere codice in vari linguaggi di programmazione in base a richieste fatte in linguaggio naturale. Esploriamo qui di seguito un paio di esempi su questo tenore.

La funzione inventata di Wikibase

Il primo ha a che fare con una mia domanda a proposito dei Qualificatori di Wikibase . Si tratta di un tipo di dato che non è accessibile tramite le cosiddette parser functions direttamente nel wikitesto di una istanza di MediaWiki, ma solo tramite codice LUA.

Curioso di sapere quale fosse la best practice per accedere ai dati, dopo aver avviato una conversazione su Wikibase per dare contesto, ho chiesto a ChatGPT «Ok, and how I access a qualifier of an item from the same Wikibase instance?».
La risposta è stata sorprendente:

To access a qualifier for an item on the same Wikibase instance from a MediaWiki page, you can use the #qualifier parser function. The #qualifier parser function allows you to retrieve the value of a qualifier for a given statement on an entity (such as an item or a lexeme).

For example, let’s say you have a Wikibase instance and you want to access the value of the “point in time” qualifier for the statement with the property “P580” on the item with the ID “Q42”. You can do this by using the following syntax:

{{#qualifier:P580|point in time|from=Q42}}

This will retrieve the value of the “point in time” qualifier for the statement with the property “P580” on the item with the ID “Q42” on the same Wikibase instance.

You can also use the #qualifiers parser function to retrieve all qualifiers for a given statement. For example, to retrieve all qualifiers for the statement with the property “P580” on the item with the ID “Q42”, you can use the following syntax:

Stupito di aver trovato una funzione a me sconosciuta, ho continuato «can you give me links to further read about #qualifiers?»

Sure! Here are some resources that you can use to learn more about the #qualifiers parser function:

These resources should provide you with a good understanding of how to use the #qualifiers and #qualifier parser functions to access qualifiers for statements on Wikibase entities from MediaWiki pages.

I hope this helps! Let me know if you have any other questions.

Alcuni dei link qui sopra sono molformati (secondo gli standard della documentazione di Mediawiki), altri portano a pagine solo tangenzialmente pretinenti all’argomento.
Su mia insistenza, la risposta è stata

I apologize for the confusion. It appears that I made a mistake in the links that I provided. Here is the correct link to the MediaWiki documentation for the #qualifiers parser function: https://www.mediawiki.org/wiki/Help:Extension:Wikibase_Client/Parser_functions#.23qualifiers.

Insospettito da questa funzione che non conoscevo assolutamente, ho continuato a cercare e mi sono confrontato con il gruppo di utenti di Wikibase i quali mi hanno giustamente indirizzato al codice sorgente dove i parser sono definiti e questa funzione effettivamente non esiste.

In questo caso quindi, incredibilmente, ChatGPT ha come inventato di sana pianta non solo una funzione, ma anche la sua sintassi e la relativa documentazione. Ho tentato in varie maniere di capire da dove avesse preso la documentazione e gli esempi, ma è stato inutile

Ipotizzo io, ma è davvero una wild guess, che ChatGPT abbia in qualche modo indotto l’esistenza di questa funzione partendo dal presupposto che i dati in Wikibase (semplificando molto) possono essere Elementi, Proprietà e Qualificatori: di conseguenza se esistono {{#statements e {{#property, allora esisterà anche un {{#qualifier.
Di nuovo, questa è una mia illazione, senza pretesa di completezza.

L’approssimazione su .NET

La mia seconda domanda a ChatGPT è stata a proposito del framework di .NET: siccome mi sto documentando per passare da ASP.NET a ASP.NET Core, ho pensato di farmi aiutare da ChatGPT facendogli qualche domanda.

La mia prima è stata a proposito di un dubbio sulla cartella App_Data: nella versione “classica” di ASP.net, questa cartella è pensata come cartella speciale, con una serie di permessi già preimpostati per accogliere database o file “di dati” in senso lato, come per esempio file XML.

Alla mia domanda «In a C# ASP.net Core project, what is the proper folder to store XML data files?», la risposta è stata:

In an ASP.NET Core project, a common location for storing XML data files is the “wwwroot” folder. The “wwwroot” folder is intended for storing static assets that are served directly to the client, such as HTML, CSS, JavaScript, and image files. XML data files can also be stored in this folder if they need to be accessed directly by the client.

To access a file in the “wwwroot” folder from your code, you can use the following syntax:

string filePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "your_xml_file.xml");

This will give you the full physical path to the file on the server, which you can then use to read or write to the file as needed.

Alternatively, you can store XML data files in a different location, such as the “App_Data” folder, which is intended for storing application data that is not served directly to the client. To access a file in the “App_Data” folder, you can use the following syntax:

string filePath = Path.Combine(Directory.GetCurrentDirectory(), "App_Data", "your_xml_file.xml");

Per approfondire, dopo aver chiesto «Thanks, but where is App_Data folder located?» ho ottenuto:

In an ASP.NET Core project, the “App_Data” folder is located at the root level of the project, alongside other top-level folders such as “wwwroot” and “Controllers”. Here is an example of a typical directory structure for an ASP.NET Core project:

MyProject
|-- App_Data
|-- Controllers
|-- Models
|-- wwwroot
|-- appsettings.json
|-- Startup.cs
|-- Program.cs

The “App_Data” folder is typically not visible in the Solution Explorer window in Visual Studio by default, but you can navigate to it by using the folder tree in the Solution Explorer or by using the file system explorer on your computer. If the “App_Data” folder does not exist in your project, you can create it by right-clicking on the project in the Solution Explorer and selecting “Add > New Folder”.

In realtà ChatGPT non sa che la cartella App_Data non è più una cartella speciale : in pratica non esiste più così come la si usa nelle versioni “classiche” di ASP.net. Senza fornire questa informazione, ChatGPT in realtà non fa per nulla un buon servizio a chi, come me, cercasse di imparare qualcosa, non di ottenere informazioni incomplete o imprecise.

Conclusioni

Non c’è dubbio che ChatGPT sia impressionante e la sua capacità di conversare sia incredibile. Tuttavia, dopo soli pochi giorni di esperimenti, mi sono già imbattuto nei due casi che leggete sopra e la cosa mi preoccupa parecchio. Mentre nel secondo caso si tratta di una serie di imprecisioni – che avrei preferito non vedere, ma che sono accettabili – più che di veri e propri errori, nel primo caso io vedo una situazione molto grave.
Per quanto non sia possibile esattamente stabilire quale sia la ragione dell’errore, produrre una tale quantità di documentazione errata, ma all’appareza corretta e ricca di dettagli, apre la strada a scenari decisamente pericolosi. Solo nell’ambito della documentazione tecnica (evito di inventrmi scenari fanta-politici che vanno ben al di fuori delo scopo di questo post) immagino la diffusione di grandi quantità di testo ben scritto, ma errato o fuorviante: indipendentemente dal fatto che sia distribuito in buona o cattiva fede, rappresenterebbe una perdita di tempo e un potenziale generatore di caos in progetti software o tecnici in generale.

A conferma di queste mie ipotesi, è interessante notare che l’autorevolissimo StackOverflow ha vietato l’uso di ChatGPT con una argomentazione tanto concisa quando significativa:

[…]The community trusts that users are submitting answers that reflect what they actually know to be accurate and that they and their peers have the knowledge and skill set to verify and validate those answers. The system relies on users to verify and validate contributions by other users with the tools we offer, including responsible use of upvotes and downvotes. Currently, contributions generated by GPT most often do not meet these standards and therefore are not contributing to a trustworthy environment. This trust is broken when users copy and paste information into answers without validating that the answer provided by GPT is correct, ensuring that the sources used in the answer are properly cited (a service GPT does not provide), and verifying that the answer provided by GPT clearly and concisely answers the question asked.
[…]

Il lettore potrebbe obiettare che sistemi come ChatGPT non vanno usati in maniera acritica, ma il loro output va interpretato cum grano salis. Sono tendenzialmente d’accordo, ma allora ribatto: se devo controllare ogni affermazione che ChatGPT faccia, allora non lo devo più trattare come un sistema esperto. Tanto vale che io vada a cercarmi le informazioni da altre fonti subito, senza prima interpellare lui e poi controllare.
Questa inaffidabilità contribuisce a renderlo, almeno per il momento, inutile all’atto pratico.

, , ,

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *