Closed abdulsamodazeez closed 1 month ago
No test cases
@DevDigiLance
import pytest
import os
from swarmauri.standard.llms.concrete.LeptonAIModel import LeptonAIModel as LLM
from swarmauri.standard.conversations.concrete.Conversation import Conversation
from swarmauri.standard.messages.concrete.AgentMessage import AgentMessage
from swarmauri.standard.messages.concrete.HumanMessage import HumanMessage
from swarmauri.standard.messages.concrete.SystemMessage import SystemMessage
@pytest.mark.skipif(not os.getenv('LEPTON_API_KEY'), reason="Skipping due to environment variable not set")
@pytest.mark.unit
def test_ubc_resource():
API_KEY = os.getenv('LEPTON_API_KEY')
llm = LLM(api_key = API_KEY)
assert llm.resource == 'LLM'
@pytest.mark.skipif(not os.getenv('LEPTON_API_KEY'), reason="Skipping due to environment variable not set")
@pytest.mark.unit
def test_ubc_type():
API_KEY = os.getenv('LEPTON_API_KEY')
llm = LLM(api_key = API_KEY)
assert llm.type == 'LeptonAIModel'
@pytest.mark.skipif(not os.getenv('LEPTON_API_KEY'), reason="Skipping due to environment variable not set")
@pytest.mark.unit
def test_serialization():
API_KEY = os.getenv('LEPTON_API_KEY')
llm = LLM(api_key = API_KEY)
assert llm.id == LLM.model_validate_json(llm.model_dump_json()).id
@pytest.mark.skipif(not os.getenv('LEPTON_API_KEY'), reason="Skipping due to environment variable not set")
@pytest.mark.unit
def test_default_name():
API_KEY = os.getenv('LEPTON_API_KEY')
model = LLM(api_key = API_KEY)
assert model.name == 'llama3-8b'
@pytest.mark.skipif(not os.getenv('LEPTON_API_KEY'), reason="Skipping due to environment variable not set")
@pytest.mark.unit
def test_no_system_context():
API_KEY = os.getenv('LEPTON_API_KEY')
model = LLM(api_key = API_KEY)
conversation = Conversation()
input_data = "Hello"
human_message = HumanMessage(content=input_data)
conversation.add_message(human_message)
model.predict(conversation=conversation)
prediction = conversation.get_last().content
assert type(prediction) == str
@pytest.mark.skipif(not os.getenv('LEPTON_API_KEY'), reason="Skipping due to environment variable not set")
@pytest.mark.acceptance
def test_nonpreamble_system_context():
API_KEY = os.getenv('LEPTON_API_KEY')
model = LLM(api_key = API_KEY)
conversation = Conversation()
# Say hi
input_data = "Hi"
human_message = HumanMessage(content=input_data)
conversation.add_message(human_message)
# Get Prediction
model.predict(conversation=conversation)
# Give System Context
system_context = 'You only respond with the following phrase, "Jeff"'
human_message = SystemMessage(content=system_context)
conversation.add_message(human_message)
# Prompt
input_data = "Hello Again."
human_message = HumanMessage(content=input_data)
conversation.add_message(human_message)
model.predict(conversation=conversation)
prediction = conversation.get_last().content
assert 'Jeff' in prediction
@pytest.mark.skipif(not os.getenv('LEPTON_API_KEY'), reason="Skipping due to environment variable not set")
@pytest.mark.unit
def test_preamble_system_context():
API_KEY = os.getenv('LEPTON_API_KEY')
model = LLM(api_key = API_KEY)
conversation = Conversation()
system_context = 'You only respond with the following phrase, "Jeff"'
human_message = SystemMessage(content=system_context)
conversation.add_message(human_message)
input_data = "Hi"
human_message = HumanMessage(content=input_data)
conversation.add_message(human_message)
model.predict(conversation=conversation)
prediction = conversation.get_last().content
assert type(prediction) == str
assert 'Jeff' in prediction
@pytest.mark.skipif(not os.getenv('LEPTON_API_KEY'), reason="Skipping due to environment variable not set")
@pytest.mark.acceptance
def test_multiple_system_contexts():
API_KEY = os.getenv('LEPTON_API_KEY')
model = LLM(api_key = API_KEY)
conversation = Conversation()
system_context = 'You only respond with the following phrase, "Jeff"'
human_message = SystemMessage(content=system_context)
conversation.add_message(human_message)
input_data = "Hi"
human_message = HumanMessage(content=input_data)
conversation.add_message(human_message)
prediction = model.predict(conversation=conversation)
system_context_2 = 'You only respond with the following phrase, "Ben"'
human_message = SystemMessage(content=system_context_2)
conversation.add_message(human_message)
input_data_2 = "Hey"
human_message = HumanMessage(content=input_data_2)
conversation.add_message(human_message)
model.predict(conversation=conversation)
prediction = conversation.get_last().content
assert type(prediction) == str
assert 'Ben' in prediction
Feature Name
Lepton AI
Feature Description
Research about Lepton AI
Research Findings
Lepton AI
Lepton AI is a cutting-edge provider of AI infrastructure and services, designed to streamline the deployment and scaling of AI models. They offer a high-performance computing environment with top-tier GPU infrastructure, ensuring fast and efficient AI inference and training. Their cloud-native platform guarantees 99.9% uptime with comprehensive health checks and automatic repairs, making it a reliable choice for enterprises.
Lepton AI is known for its Pythonic framework, which simplifies the process of converting research and modeling code into production-ready services. They cater to a wide range of use cases, including image generation, natural language processing, and large-scale data processing. With features like dynamic batching, quantization, and speculative decoding, Lepton AI provides a robust and scalable solution for businesses looking to leverage AI technology. Their commitment to security and compliance, including SOC2 and HIPAA certifications, makes them a trusted partner for enterprise applications.
Use Cases
Additional Information
Links
Potential Impact
Lepton AI has the potential to significantly transform various industries by making AI more accessible and efficient. By providing a high-performance computing environment with top-tier GPU infrastructure, Lepton AI enables faster and more efficient AI model training and inference. This can lead to quicker deployment of AI solutions, reducing time-to-market for innovative products and services.
In sectors like healthcare, finance, and retail, Lepton AI’s robust and scalable platform can enhance data processing capabilities, improve predictive analytics, and enable more personalized customer experiences. For instance, in healthcare, it can support advanced diagnostic tools and personalised treatment plans. In finance, it can enhance fraud detection and risk management. Overall, Lepton AI’s comprehensive and secure AI infrastructure can drive significant advancements in technology and business processes, fostering innovation and efficiency across various domains.
Additional Resources (optional)
No response
Feature Priority
High