mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-06 13:33:37 +00:00
Add GooseAI, CerebriumAI, Petals, ForefrontAI (#981)
Add GooseAI, CerebriumAI, Petals, ForefrontAI
This commit is contained in:
10
tests/integration_tests/llms/test_cerebrium.py
Normal file
10
tests/integration_tests/llms/test_cerebrium.py
Normal 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)
|
10
tests/integration_tests/llms/test_forefrontai.py
Normal file
10
tests/integration_tests/llms/test_forefrontai.py
Normal 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)
|
28
tests/integration_tests/llms/test_gooseai.py
Normal file
28
tests/integration_tests/llms/test_gooseai.py
Normal 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
|
10
tests/integration_tests/llms/test_petals.py
Normal file
10
tests/integration_tests/llms/test_petals.py
Normal 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)
|
Reference in New Issue
Block a user