{"id":463,"date":"2024-08-05T18:12:00","date_gmt":"2024-08-05T18:12:00","guid":{"rendered":"https:\/\/justin.ooo\/?p=463"},"modified":"2024-08-05T23:32:50","modified_gmt":"2024-08-05T23:32:50","slug":"improving-code-generation-via-llms-summawise","status":"publish","type":"post","link":"https:\/\/justin.ooo\/index.php\/2024\/08\/05\/improving-code-generation-via-llms-summawise\/","title":{"rendered":"Improving Code Generation via LLMs &#8211; summawise"},"content":{"rendered":"\n<p>Using LLMs for code generation has been slowly but surely become increasingly common. Using OpenAI (GPT-4 or GPT-4o at the time of writing) I&#8217;m often disappointed with the quality of the results that are offered by default. By providing more information to the LLM which can be stored in the context window and accessed via vector embeddings, the results can be improved somewhat notably. This is a concept I recently explored in an open-source program I developed entitled <a href=\"https:\/\/github.com\/ooojustin\/summawise\">summawise<\/a>. By default, the tool will allow you to interact with a provided source by embedding the data in a vector store when establishing a prompt session (also referred to as a &#8220;thread&#8221; on the OpenAI platform).  The decision making of the model is based on the concept of an OpenAI &#8220;assistant&#8221;, and new assistants can be created to improve the models outputs in accordance with your needs. The following inputs are supported::<\/p>\n\n\n\n<ul>\n<li>Local files. (Any type of content, file will be uploaded byte for byte)<\/li>\n\n\n\n<li>Local directories. (Includes files in nested directories)]\\<\/li>\n\n\n\n<li>YouTube video URLs. (Transcript is extracted and used as text)<\/li>\n\n\n\n<li>Other URLs, depending on the response content. (Text content, PDF files, and HTML are all supported)<\/li>\n<\/ul>\n\n\n\n<p>The ability to establish a thread with data the model can access outside of the immediate context window (and ability to summarise the data or generate code from it) is accomplished by implementing OpenAI&#8217;s API powerful models, and then expanding ChatGPT&#8217;s default capabilities by using features that are currently in OpenAI beta. Afterwards you can explore the data further or generate code\/information using an interactive prompt in your CLI very similar to web-based LLM clients.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Installation<\/h2>\n\n\n\n<p>Summawise is accessible via PyPI for convenience:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">pip install --upgrade summawise<\/code><\/pre>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Key Features and Usage<\/h2>\n\n\n\n<p>The tool is designed to be user-friendly, integrating easily into various workflows. It supports a range of inputs, including YouTube video URLs for transcript extraction, local files and directories, and text\/pdf\/html content from other URLs.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">summawise --help  # Displays help information and usage instructions<\/code><\/pre>\n\n\n\n<p>While summawise aims to simplify the process of summarizing and analyzing large amounts of data, it&#8217;s still in the development phase and may not always deliver perfect results.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">API Resources<\/h2>\n\n\n\n<ul>\n<li><a href=\"https:\/\/platform.openai.com\/docs\/assistants\/overview\">Assistants API<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/platform.openai.com\/docs\/api-reference\/threads\">Threads<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/platform.openai.com\/docs\/api-reference\/vector-stores\">Vector Stores<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/platform.openai.com\/docs\/assistants\/tools\/file-search\">File Search (assistant tool)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/platform.openai.com\/docs\/assistants\/tools\/code-interpreter\">Code Interpreter (assistant tool)<\/a><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Summawise is a practical tool that seeks to improve how developers and researchers handle and summarize large datasets and complex information. It\u2019s a step forward in making powerful language models more accessible and useful in everyday tasks. For continuous updates and more information, you can visit the <a href=\"https:\/\/github.com\/ooojustin\/summawise\">summawise GitHub repository<\/a> or the <a href=\"https:\/\/pypi.org\/project\/summawise\/\">PyPI package page<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using LLMs for code generation has been slowly but surely become increasingly common. Using OpenAI (GPT-4 or GPT-4o at the time of writing) I&#8217;m often disappointed with the quality of the results that are offered by default. By providing more information to the LLM which can be stored in the context window and accessed via vector embeddings, the results can be improved somewhat notably. This is a concept I recently [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[12,2,3],"tags":[],"_links":{"self":[{"href":"https:\/\/justin.ooo\/index.php\/wp-json\/wp\/v2\/posts\/463"}],"collection":[{"href":"https:\/\/justin.ooo\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/justin.ooo\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/justin.ooo\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/justin.ooo\/index.php\/wp-json\/wp\/v2\/comments?post=463"}],"version-history":[{"count":16,"href":"https:\/\/justin.ooo\/index.php\/wp-json\/wp\/v2\/posts\/463\/revisions"}],"predecessor-version":[{"id":481,"href":"https:\/\/justin.ooo\/index.php\/wp-json\/wp\/v2\/posts\/463\/revisions\/481"}],"wp:attachment":[{"href":"https:\/\/justin.ooo\/index.php\/wp-json\/wp\/v2\/media?parent=463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/justin.ooo\/index.php\/wp-json\/wp\/v2\/categories?post=463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/justin.ooo\/index.php\/wp-json\/wp\/v2\/tags?post=463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}