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 SummaryConstructors
- 
Method SummaryModifier 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- 
getpublic static ChatGPT get(long userId) throws com.logicaldoc.core.PersistenceException, com.logicaldoc.util.security.StringEncrypter.EncryptionException - Throws:
- com.logicaldoc.core.PersistenceException
- com.logicaldoc.util.security.StringEncrypter.EncryptionException
 
- 
getModel
- 
setModel
- 
getApiKey
- 
getAssistantId
- 
setApiKey
- 
setAssistantId
- 
prepareThread- Throws:
- IOException
 
- 
askAsks a question and waits for the full answer- Parameters:
- question- The question to ask
- Returns:
- The complete answer
- Throws:
- IOException- Communication error
 
- 
askAsyncpublic Future<org.apache.hc.core5.http.HttpResponse> askAsync(String question, ResponseConsumer consumer) throws IOException Asynchronously asks a question- Parameters:
- question- The question to ask
- consumer- 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 interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException
 
- 
saveSettingspublic 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 layer
- com.logicaldoc.util.security.StringEncrypter.EncryptionException- Error encrypting the API key
 
- 
getDocuments
 
-