
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
chat-object
Advanced tools
A simple library for creating and manipulating chat and message objects for LLM applications
A simple library for creating and managing chat objects and messages for LLM applications.
From PyPI:
pip install chat-object
From GitHub:
pip install git+https://github.com/fresh-milkshake/chat-object.git
Or from source:
git clone https://github.com/fresh-milkshake/chat-object.git
cd chat-object
pip install -e .
Create a chat object and add messages to it:
import openai
from chat_object import Chat, Message, Role
client = openai.OpenAI()
chat = Chat(
Message(Role.System, "You are a helpful assistant"),
Message(Role.User, "Hello!")
)
response = client.chat.completions.create(
model="gpt-5-nano",
messages=chat.as_dict()
)
print(response.choices[0].message.content)
The Prompt
class automatically handles indentation and formatting:
from chat_object import Prompt
# Clean indentation automatically
prompt = Prompt("""
You are a helpful assistant.
Please help me with the following task:
def example_function():
return "hello world"
Explain what this function does.
""")
# Multiple arguments are joined with newlines
prompt = Prompt(
"You are a helpful assistant.",
"Please be concise in your responses.",
"Focus on practical solutions."
)
# String operations work naturally
prompt += "\n\nAdditional context here"
Use convenience functions for faster development:
from chat_object import chat, msg_user, msg_system, msg_assistant, prmt
# Quick chat creation
chat_obj = chat(
msg_system("You are a helpful assistant."),
msg_user("Hello!"),
msg_assistant("Hi there! How can I help you today?")
)
# Quick prompt creation
prompt = prmt("You are a helpful assistant.")
# Convert to dict for API calls
messages = chat_obj.as_dict()
[!TIP] See examples folder for more comprehensive examples.
msg_user
, msg_assistant
, msg_system
, prmt
, msgs
, chat
(Recommended, but not required). Pretty rich example usage of qol features is in examples/openai_use_case.py.This project is licensed under the MIT License. See the LICENSE file for details.
FAQs
A simple library for creating and manipulating chat and message objects for LLM applications
We found that chat-object demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.