Skip to content

About

This project is a LinkedIn post generator. When making this project I used Python, Groq Cloud and "openai/gpt-oss-120b" LLM model and my own LinkedIn text data. In the project there are 2 stages. In the first stage we are preprocessing the data and enriching it and in the second step we are generating new posts using our enriched data.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

LinkedIn Post Generator

This project is a AI powered LinkedIn post generator. When making this project I used Python, Groq Cloud and "openai/gpt-oss-120b" LLM model, StreamLit for web view and my own LinkedIn text data. In the project there are 2 stages. In the first stage we are preprocessing the data and enriching it and in the second step we are generating new posts using our enriched data.

Let's cover what is inside nin this project?

First let's start with our " preprocess.py " file.

This file aims to process the raw data and enrich it with metadata ( line count, language, tags ) In this file we have 3 functions: 1 - Process Posts - Main function for processing. We are reading the raw data here enrich it using other 2 functions and then store it in a json file. 2 - Extract Metadata - In this function we are using our LLM model to extract line count, language and the maximum of 2 tags for the raw data texts. When we send a request to LLM using API we get a result back and we store it as variable after that we parse the content in a try catch block for safety. 3 - Get Unified Tags - In this part we are using our LLM model and give it a template for to make similar tags into one unified tag. ( The tags came from the metadata ) We send a request using our API using similar template to the one in the extract metadata function. After that we get unique tag list and return it.

After this part is done we have already preprocess our raw data and turned into a processed data in json format. We use few shot learning, LLM, prompting and json parsing as well as try and catch blocks for safety.

Let's continue with the "llm_helper.py"

In this particular file we used a simple loading operation from Groq Cloud. We selected our LLM model here and also called our API key from the .env file ( which is special to the developer )

Now it's time for "few_shot.py" file

This file is mainly a for making the whole system more modular and object oriented. In this part we defined a class named FewShotPosts. We initialized a initial function and then helper functions to use it later in the generating parts. For example we set conditions for length of the content. It was based on our own data. So if needed it can adjusted later. And we added some main features to the class like language, tags and length.

Last 2 files and now let's explain "post_generator.py"

In this file we aimed to build the system to generate LLM powered filtered posts. We again have 3 functions here: 1 - Get Length Str - This functions helps for better prompting by converting short, medium and long text into numerical information in string format. 2 - Get Prompt - In this function we are designing the prompt using get length function and our class object attributes. 3 - Generate Post - This is where we send request to LLM and give it a prompt for generating. We return the response of the LLM.

Last and the main function : "main.py"

We are building a simple web based UI using StreamLit and add all of the things that we have done to here but of course necessary ones. The main file is organized because of the modularity of this project.

Thank you for reading hope to see you in next projects !!

About

This project is a LinkedIn post generator. When making this project I used Python, Groq Cloud and "openai/gpt-oss-120b" LLM model and my own LinkedIn text data. In the project there are 2 stages. In the first stage we are preprocessing the data and enriching it and in the second step we are generating new posts using our enriched data.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages