diff --git a/ai/langchain/src/test/kotlin/org/http4k/connect/langchain/LmStudioTestCase.kt b/ai/langchain/src/test/kotlin/org/http4k/connect/langchain/LmStudioTestCase.kt new file mode 100644 index 000000000..33de10ba2 --- /dev/null +++ b/ai/langchain/src/test/kotlin/org/http4k/connect/langchain/LmStudioTestCase.kt @@ -0,0 +1,15 @@ +package org.http4k.connect.langchain + +import org.http4k.client.JavaHttpClient +import org.http4k.core.Method +import org.http4k.core.Request +import org.junit.jupiter.api.Assumptions + +abstract class LmStudioTestCase { + init { + Assumptions.assumeTrue( + JavaHttpClient()(Request(Method.GET, "http://localhost:1234/")).status.successful, + "No LmStudio server running" + ) + } +} diff --git a/ai/langchain/src/test/kotlin/org/http4k/connect/langchain/chat/LmStudioChatLanguageModelTest.kt b/ai/langchain/src/test/kotlin/org/http4k/connect/langchain/chat/LmStudioChatLanguageModelTest.kt index 9fafb81b9..4cbd6c56c 100644 --- a/ai/langchain/src/test/kotlin/org/http4k/connect/langchain/chat/LmStudioChatLanguageModelTest.kt +++ b/ai/langchain/src/test/kotlin/org/http4k/connect/langchain/chat/LmStudioChatLanguageModelTest.kt @@ -1,12 +1,13 @@ package org.http4k.connect.langchain.chat +import org.http4k.connect.langchain.LmStudioTestCase import org.http4k.connect.lmstudio.CHAT_MODEL import org.http4k.connect.lmstudio.FakeLmStudio import org.http4k.connect.lmstudio.Http import org.http4k.connect.lmstudio.LmStudio import org.http4k.connect.model.ModelName -class LmStudioChatLanguageModelTest : ChatLanguageModelContract { +class LmStudioChatLanguageModelTest : LmStudioTestCase(), ChatLanguageModelContract { override val model by lazy { LmStudioChatLanguageModel( LmStudio.Http(FakeLmStudio()), diff --git a/ai/langchain/src/test/kotlin/org/http4k/connect/langchain/embedding/LmStudioEmbeddingModelTest.kt b/ai/langchain/src/test/kotlin/org/http4k/connect/langchain/embedding/LmStudioEmbeddingModelTest.kt index 7d0708595..b680a2714 100644 --- a/ai/langchain/src/test/kotlin/org/http4k/connect/langchain/embedding/LmStudioEmbeddingModelTest.kt +++ b/ai/langchain/src/test/kotlin/org/http4k/connect/langchain/embedding/LmStudioEmbeddingModelTest.kt @@ -1,11 +1,12 @@ package org.http4k.connect.langchain.embedding +import org.http4k.connect.langchain.LmStudioTestCase import org.http4k.connect.lmstudio.CHAT_MODEL import org.http4k.connect.lmstudio.FakeLmStudio import org.http4k.connect.lmstudio.Http import org.http4k.connect.lmstudio.LmStudio import org.http4k.connect.model.ModelName -class LmStudioEmbeddingModelTest : EmbeddingModelContract { +class LmStudioEmbeddingModelTest : LmStudioTestCase(), EmbeddingModelContract { override val model = LmStudioEmbeddingModel(LmStudio.Http(FakeLmStudio()), ModelName.CHAT_MODEL) } diff --git a/ai/langchain/src/test/resources/org/http4k/connect/langchain/chat/LmStudioChatLanguageModelTest.can call through to language model.approved b/ai/langchain/src/test/resources/org/http4k/connect/langchain/chat/LmStudioChatLanguageModelTest.can call through to language model.approved new file mode 100644 index 000000000..1f54188b4 --- /dev/null +++ b/ai/langchain/src/test/resources/org/http4k/connect/langchain/chat/LmStudioChatLanguageModelTest.can call through to language model.approved @@ -0,0 +1,10 @@ +Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. + +Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. + +Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. +Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. + +Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. + +Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. \ No newline at end of file diff --git a/ai/langchain/src/test/resources/org/http4k/connect/langchain/chat/LmStudioChatLanguageModelTest.can use the model in a chain.approved b/ai/langchain/src/test/resources/org/http4k/connect/langchain/chat/LmStudioChatLanguageModelTest.can use the model in a chain.approved new file mode 100644 index 000000000..1f54188b4 --- /dev/null +++ b/ai/langchain/src/test/resources/org/http4k/connect/langchain/chat/LmStudioChatLanguageModelTest.can use the model in a chain.approved @@ -0,0 +1,10 @@ +Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. + +Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. + +Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. +Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. + +Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. + +Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. \ No newline at end of file diff --git a/ai/langchain/src/test/resources/org/http4k/connect/langchain/embedding/LmStudioEmbeddingModelTest.can call through to language model.approved b/ai/langchain/src/test/resources/org/http4k/connect/langchain/embedding/LmStudioEmbeddingModelTest.can call through to language model.approved new file mode 100644 index 000000000..b57304d89 --- /dev/null +++ b/ai/langchain/src/test/resources/org/http4k/connect/langchain/embedding/LmStudioEmbeddingModelTest.can call through to language model.approved @@ -0,0 +1 @@ +[0.9916232, 1.0206] \ No newline at end of file