A Python package that helps users find the perfect replacement for their lost or damaged MagSafe cable. The package processes user input to generate a structured list of recommended MagSafe cables, highlighting key features, compatibility, and potential drawbacks. It also provides troubleshooting tips and maintenance advice.
You can install the package via pip:
pip install mag_safe_finderHere's a basic example of how to use the package:
from mag_safe_finder import mag_safe_finder
user_input = "I need a durable MagSafe cable for my MacBook Pro that won't fray easily."
response = mag_safe_finder(user_input=user_input)
print(response)By default, the package uses ChatLLM7 from langchain_llm7 (see PyPI). However, you can pass your own LangChain-compatible LLM instance (based on LangChain documentation):
from langchain_openai import ChatOpenAI
from mag_safe_finder import mag_safe_finder
llm = ChatOpenAI()
response = mag_safe_finder(user_input="Your input here", llm=llm)from langchain_anthropic import ChatAnthropic
from mag_safe_finder import mag_safe_finder
llm = ChatAnthropic()
response = mag_safe_finder(user_input="Your input here", llm=llm)from langchain_google_genai import ChatGoogleGenerativeAI
from mag_safe_finder import mag_safe_finder
llm = ChatGoogleGenerativeAI()
response = mag_safe_finder(user_input="Your input here", llm=llm)user_input(str): The user input text to process.llm(Optional[BaseChatModel]): The LangChain LLM instance to use. If not provided, the defaultChatLLM7will be used.api_key(Optional[str]): The API key for LLM7. If not provided, the package will try to use theLLM7_API_KEYenvironment variable.
The default rate limits for LLM7 free tier are sufficient for most use cases. If you need higher rate limits, you can:
- Set the
LLM7_API_KEYenvironment variable, or - Pass the API key directly:
mag_safe_finder(..., api_key="your_api_key")
You can get a free API key by registering at https://token.llm7.io/.
If you encounter any issues or have feature requests, please open an issue on GitHub.
- Eugene Evstafev - hi@euegne.plus
- GitHub: chigwell