https://github.com/definetlynotai/llm_class
Simple class python file that can determine toxicity, retrieve yahoo stocks and complete text for you, with super high customisation
https://github.com/definetlynotai/llm_class
class complex llm python stocks text-completion toxicity-classification transformer-models transformers yahoo
Last synced: 3 months ago
JSON representation
Simple class python file that can determine toxicity, retrieve yahoo stocks and complete text for you, with super high customisation
- Host: GitHub
- URL: https://github.com/definetlynotai/llm_class
- Owner: DefinetlyNotAI
- License: mit
- Archived: true
- Created: 2024-07-08T13:12:57.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-27T20:25:05.000Z (about 1 year ago)
- Last Synced: 2025-04-20T18:37:59.686Z (6 months ago)
- Topics: class, complex, llm, python, stocks, text-completion, toxicity-classification, transformer-models, transformers, yahoo
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# LLM_Class 📎
Welcome to `LLM_Class` 🌐,
Crafted with python and Hugging Face 🐍, by DefinetlyNotAI 🤗.
This comprehensive guide is here to equip you with everything you need to use `LLM_Class` effectively.# LLM_Class
The `LLM_Class` is a Python class designed to provide financial market insights through
various functionalities including retrieving stock news,
fetching historical stock data, generating text based on prompts,
and analyzing the sentiment of given texts as well as act like a basic language model.
It leverages external libraries such as `requests`, `BeautifulSoup`, `yfinance`, and `transformers`
from Hugging Face to perform these tasks efficiently.## Prerequisites
Before you begin, ensure you have met the following requirements:
- You have installed Python 3.8 or later.
- You have installed the required Python packages from the [requirements.ps1](requirements.ps1) file.
- You are using windows
- You have at least 6GB of Storage available
- You have a dedicated nvidea GPU supporting CUDA 11.8## Installation
If you plan to modify or extend the functionality of the `LLM_Class`, clone the repository and install the required packages locally.
```bash
git clone https://github.com/DefinetlyNotAI/LLM_Class.git
cd LLM_Class
.\requirements.ps1
```## Usage
### Initialization
First, import the `LLM_Class` class and create an instance of it:
```python
from LLM import LLMllm = LLM()
```### Getting Stock News
To retrieve the latest news headlines for a specific stock ticker, use the `get_stock_news` method:
```python
news_headlines = llm.get_stock_news('AAPL')
print("News Headlines:", news_headlines)
```This is the most unsupported feature of the `LLM_Class`.
### Fetching Historical Stock Data
To fetch historical stock data for a given ticker symbol over the past year, use the `get_stock_data` method:
```python
stock_data = llm.get_stock_data('AAPL')
print(stock_data)
```### Generating Text
To generate text based on a given prompt using a customizable text generation pipeline,
use the `generate_text` method:```python
generated_text = llm.generate_text(prompt="What is the future of AI in finance?")
print(generated_text)
```### Analyzing Sentiment
To analyze the sentiment of a given text, use the `analyze_sentiment` method:
```python
sentiment = llm.analyze_sentiment(text="The stock market is volatile today.")
print(sentiment)
```## Contributing
Contributions are what make the open-source community such an amazing place to learn,
inspire, and create. Any contributions you make are **greatly appreciated**.1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull RequestBut don't hesitate to [open an Issue](https://github.com/DefinetlyNotAI/LLM_Class/issues)
if you have any questions or encounter any issues.Most importantly, **don't forget to follow us!** and read our [Contributing Guide](CONTRIBUTING.md).
## License
Distributed under the MIT License. See [LICENSE](LICENSE) for more information.
## Contact
Shahm Najeeb - Nirt_12023@outlook.com
Project Link: [https://github.com/DefinetlyNotAI/LLM_Class](https://github.com/DefinetlyNotAI/LLM_Class)