Package com.logicaldoc.chatgpt
Class ChatGPT
java.lang.Object
com.logicaldoc.chatgpt.ChatGPT
- All Implemented Interfaces:
Closeable,AutoCloseable
This is a facade over the Remote ChatGPT service. You instantiate this object
on a population of documents and then you may ask questions about them
- Since:
- 8.9.4
- Author:
- Marco Meschieri - LogicalDOC
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAsks a question and waits for the full answerFuture<org.apache.hc.core5.http.HttpResponse> askAsync(String question, ResponseConsumer consumer) Asynchronously asks a questionvoidclose()static ChatGPTget(long userId) List<com.logicaldoc.core.document.Document> getModel()voidvoidsaveSettings(long userId) Saves the current settings in the user's profilevoidvoidsetAssistantId(String assistantId) void
-
Constructor Details
-
ChatGPT
-
ChatGPT
-
-
Method Details
-
get
public static ChatGPT get(long userId) throws com.logicaldoc.core.PersistenceException, com.logicaldoc.util.security.StringEncrypter.EncryptionException - Throws:
com.logicaldoc.core.PersistenceExceptioncom.logicaldoc.util.security.StringEncrypter.EncryptionException
-
getModel
-
setModel
-
getApiKey
-
getAssistantId
-
setApiKey
-
setAssistantId
-
prepareThread
- Throws:
IOException
-
ask
Asks a question and waits for the full answer- Parameters:
question- The question to ask- Returns:
- The complete answer
- Throws:
IOException- Communication error
-
askAsync
public Future<org.apache.hc.core5.http.HttpResponse> askAsync(String question, ResponseConsumer consumer) throws IOException Asynchronously asks a question- Parameters:
question- The question to askconsumer- The consumer that receives the answer chunks- Returns:
- The Future task you may wait for the completion
- Throws:
IOException- Communication error
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
saveSettings
public void saveSettings(long userId) throws com.logicaldoc.core.PersistenceException, com.logicaldoc.util.security.StringEncrypter.EncryptionException Saves the current settings in the user's profile- Parameters:
userId- The current user- Throws:
com.logicaldoc.core.PersistenceException- Error in the data layercom.logicaldoc.util.security.StringEncrypter.EncryptionException- Error encrypting the API key
-
getDocuments
-