Add GooseAI, CerebriumAI, Petals, ForefrontAI (#981)

Add GooseAI, CerebriumAI, Petals, ForefrontAI
This commit is contained in:
Enrico Shippole
2023-02-14 00:20:19 -05:00
committed by GitHub
parent d43d430d86
commit f30dcc6359
20 changed files with 1283 additions and 1 deletions

View File

@@ -0,0 +1,10 @@
"""Test CerebriumAI API wrapper."""
from langchain.llms.cerebriumai import CerebriumAI
def test_cerebriumai_call() -> None:
"""Test valid call to cerebriumai."""
llm = CerebriumAI(max_length=10)
output = llm("Say foo:")
assert isinstance(output, str)

View File

@@ -0,0 +1,10 @@
"""Test ForefrontAI API wrapper."""
from langchain.llms.forefrontai import ForefrontAI
def test_forefrontai_call() -> None:
"""Test valid call to forefrontai."""
llm = ForefrontAI(length=10)
output = llm("Say foo:")
assert isinstance(output, str)

View File

@@ -0,0 +1,28 @@
"""Test GooseAI API wrapper."""
from langchain.llms.gooseai import GooseAI
def test_gooseai_call() -> None:
"""Test valid call to gooseai."""
llm = GooseAI(max_tokens=10)
output = llm("Say foo:")
assert isinstance(output, str)
def test_gooseai_call_fairseq() -> None:
"""Test valid call to gooseai with fairseq model."""
llm = GooseAI(model_name="fairseq-1-3b", max_tokens=10)
output = llm("Say foo:")
assert isinstance(output, str)
def test_gooseai_stop_valid() -> None:
"""Test gooseai stop logic on valid configuration."""
query = "write an ordered list of five items"
first_llm = GooseAI(stop="3", temperature=0)
first_output = first_llm(query)
second_llm = GooseAI(temperature=0)
second_output = second_llm(query, stop=["3"])
# Because it stops on new lines, shouldn't return anything
assert first_output == second_output

View File

@@ -0,0 +1,10 @@
"""Test Petals API wrapper."""
from langchain.llms.petals import Petals
def test_gooseai_call() -> None:
"""Test valid call to gooseai."""
llm = Petals(max_new_tokens=10)
output = llm("Say foo:")
assert isinstance(output, str)