This example demonstrates how to use an Interaction to proofread documentation, utilizing Composable Prompts's Studio.
The Interaction, named "Proofread Documentation", accepts a document as input and outputs the updated document. Although it uses GPT-4 by default, it can also run on Llama2 and Mistral with ease.
As shown, executing this task with an LLM and integrating it into your client code requires less than 10 lines of code!
For more information on how to use Interactions in Typescript / Javascript, refer to the documentation.
Feel free to clone and use this code as a base.
We aim to transform it into a generic Github Action for seamless integration into workflows.
-
Create an Interaction
Proofread Documentationin your Composable Prompts's project-
The input schema should include one field:
content -
The output schema should consist of two fields:
updated_contentandchanges_summary
-
-
Clone this repository / folder and install cpcli
-
Synchronize your interaction:
$ cpcli -p <projectId> -k <apikey> export interactions.ts- Execute the proofreading of a file:
$ ts-node --esm index.ts <your_file.mdx>
Token Count: 715
Response:
Received response in 60797ms
Length of updated doc: 3164
Token used: 1665
Summary of Changes: Clarified some sentences for better understanding, corrected some grammatical errors, and improved the overall flow of the document.
Saving updated file: ./yourfile.updated.mdx- You can then also view the runs in your Composable Prompts's Studio Run Console
This example illustrates how to employ an LLM in your code, eliminating the need for complex integration tasks, while keeping prompts and application separate. Plus, it's quite handy for writing docs!