Skip to content

Commit

Permalink
Merge pull request agiresearch#25 from dongyuanjushi/main
Browse files Browse the repository at this point in the history
add test code and dependencies via pytest
  • Loading branch information
AGI Research authored Apr 3, 2024
2 parents dc5b340 + dc679eb commit 3fc831f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ torch==2.0.1
transformers==4.38.1
wolframalpha==5.0.0
pre-commit==3.7.0
pytest==8.1.1
Empty file added src/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion src/llms/llms.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import time

class LLMKernel:
def __init__(self, llm_name: str, max_gpu_memory: dict, eval_device: str, max_new_tokens: int = 256):
def __init__(self, llm_name: str, max_gpu_memory: dict = None, eval_device: str = None, max_new_tokens: int = 256):
print("Initialize AIOS powered by LLM: {}".format(llm_name))
self.config = self.load_config(llm_name)
self.max_gpu_memory = max_gpu_memory
Expand Down
13 changes: 13 additions & 0 deletions tests/test_llms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import sys

import os

from src.llms.llms import LLMKernel

def test_closed_llm():
llm_type = "gemini-pro"
llm = LLMKernel(llm_type)
prompt = "Craft a tale about a valiant warrior on a quest to uncover priceless treasures hidden within a mystical island."
response = llm.address_request(prompt)
assert isinstance(response, str)
print(response)

0 comments on commit 3fc831f

Please sign in to comment.