Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/w 16235578 add image munits #43

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/test/munit/langchain-embedding-operation-testing-suite.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
http://www.mulesoft.org/schema/mule/munit-tools http://www.mulesoft.org/schema/mule/munit-tools/current/mule-munit-tools.xsd
http://www.mulesoft.org/schema/mule/ms-aichain http://www.mulesoft.org/schema/mule/ms-aichain/current/mule-ms-aichain.xsd">
<munit:config name="langchain-embedding-operation-testing-suite.xml" />
<munit:test name="EmbeddingNewStore-test" doc:id="b794e6e8-779e-494a-9f95-d461103b7bbd" >
<munit:test name="embedding-new-store-test" doc:id="b794e6e8-779e-494a-9f95-d461103b7bbd" >
<munit:execution>
<ms-aichain:embedding-new-store doc:name="Embedding new store" doc:id="8f4b53ec-f238-4af0-bc9b-f18bc8ef579a" storeName="target/embedding.store"/>
</munit:execution>
Expand All @@ -23,7 +23,7 @@ payload.status must contain("created")]]]></munit-tools:that>
</munit:validation>
</munit:test>

<munit:test name="EmbeddingAddFile-test" doc:id="3fea6933-396d-4a2b-813e-ae9248021548" >
<munit:test name="embedding-add-file-test" doc:id="3fea6933-396d-4a2b-813e-ae9248021548" >
<munit:behavior>
<ms-aichain:embedding-new-store doc:name="Embedding new store" doc:id="8f4b53ec-f238-4af0-bc9b-f18bc8ef579a" storeName="target/embedding.store"/>
</munit:behavior>
Expand All @@ -40,7 +40,7 @@ payload.status must contain("updated")]]]></munit-tools:that>
</munit:validation>
</munit:test>

<munit:test name="EmbeddingAddFolder-test" doc:id="b1120c8d-2c9e-4a0f-9a24-1645c2367992" >
<munit:test name="embedding-add-folder-test" doc:id="b1120c8d-2c9e-4a0f-9a24-1645c2367992" >
<munit:behavior >
<ms-aichain:embedding-new-store doc:name="Embedding new store" doc:id="8f4b53ec-f238-4af0-bc9b-f18bc8ef579a" storeName="target/embedding.store"/>
</munit:behavior>
Expand All @@ -57,7 +57,7 @@ payload.status must equalTo("updated")]]]></munit-tools:that>
</munit:validation>
</munit:test>

<munit:test name="EmbeddingQueryStore-test" doc:id="b3c6a483-b789-425b-a139-878d76208383" >
<munit:test name="embedding-query-store-test" doc:id="b3c6a483-b789-425b-a139-878d76208383" >
<munit:behavior >
<ms-aichain:embedding-new-store doc:name="Embedding new store" doc:id="8f4b53ec-f238-4af0-bc9b-f18bc8ef579a" storeName="target/embedding.store"/>
<ms-aichain:embedding-add-document-to-store doc:name="Embedding add document to store" doc:id="7f5feb33-8302-4c06-a358-a23267b808fb" storeName="target/embedding.store" contextPath='${app.home}/embeddingaddfiletest/Foundations_for_High_Scalability_in_Mule_4.pdf' fileType="any" maxSegmentSizeInChars="2000" maxOverlapSizeInChars="200"/>
Expand All @@ -79,7 +79,7 @@ payload.response must contain("reactive programming")]]]></munit-tools:that>
</munit:validation>
</munit:test>

<munit:test name="EmbeddingGetInfo-test" doc:id="623bfe65-ab6f-44c1-8482-bbe5f5562801" >
<munit:test name="embedding-get-info-test" doc:id="623bfe65-ab6f-44c1-8482-bbe5f5562801" >
<munit:behavior >
<ms-aichain:embedding-new-store doc:name="Embedding new store" doc:id="8f4b53ec-f238-4af0-bc9b-f18bc8ef579a" storeName="target/embedding.store"/>
<ms-aichain:embedding-add-document-to-store doc:name="Embedding add document to store" doc:id="7f5feb33-8302-4c06-a358-a23267b808fb" storeName="target/embedding.store" contextPath='${app.home}/embeddingaddfiletest/Foundations_for_High_Scalability_in_Mule_4.pdf' fileType="any" maxSegmentSizeInChars="2000" maxOverlapSizeInChars="200"/>
Expand All @@ -101,7 +101,7 @@ payload.response must contain("reactive programming")]]]></munit-tools:that>
</munit:validation>
</munit:test>

<munit:test name="EmbeddingGetInfoLegacy-test" doc:id="ad92562c-29dd-4989-a474-13aaca9e404b" >
<munit:test name="embedding-get-info-legacy-test" doc:id="ad92562c-29dd-4989-a474-13aaca9e404b" >
<munit:behavior >
<ms-aichain:embedding-new-store doc:name="Embedding new store" doc:id="8f4b53ec-f238-4af0-bc9b-f18bc8ef579a" storeName="target/embedding.store"/>
<ms-aichain:embedding-add-document-to-store doc:name="Embedding add document to store" doc:id="7f5feb33-8302-4c06-a358-a23267b808fb" storeName="target/embedding.store" contextPath='${app.home}/embeddingaddfiletest/Foundations_for_High_Scalability_in_Mule_4.pdf' fileType="any" maxSegmentSizeInChars="2000" maxOverlapSizeInChars="200"/>
Expand All @@ -123,7 +123,7 @@ payload.response must contain("reactive programming")]]]></munit-tools:that>
</munit:validation>
</munit:test>

<munit:test name="ToolsAIService-test" doc:id="69c1e915-63fb-4568-b0b4-464886a7dd07" >
<munit:test name="tools-ai-service-test" doc:id="69c1e915-63fb-4568-b0b4-464886a7dd07" >
<munit:execution >
<ms-aichain:tools-use-ai-service doc:name="Tools use ai service" doc:id="e7a3fcc4-653e-45c8-8f95-7b22ba9e4a63" config-ref="OPENAIGPT4" toolConfig="${app.home}/tools.config.json">
<ms-aichain:data>
Expand All @@ -141,7 +141,7 @@ attributes.toolsUsed must equalTo(true)]]]></munit-tools:that>
</munit:validation>
</munit:test>

<munit:test name="ToolsAIService-legacy-test" doc:id="f1a34fb7-b252-4f6f-a6be-f68a7644bc9b" >
<munit:test name="tools-ai-service-legacy-test" doc:id="f1a34fb7-b252-4f6f-a6be-f68a7644bc9b" >
<munit:execution >
<ms-aichain:tools-use-ai-service-legacy doc:name="Tools use ai service legacy" doc:id="51aa98dc-0ad2-42ad-9fc0-0883bdb766a4" config-ref="OPENAIGPT4" toolConfig="${app.home}/tools.config.json">
<ms-aichain:data>
Expand All @@ -159,7 +159,7 @@ attributes.toolsUsed must equalTo(true)]]]></munit-tools:that>
</munit:validation>
</munit:test>

<munit:test name="RAG-test" doc:id="36e4172f-0a2c-4c2e-9546-8f4f30c6cc93" >
<munit:test name="rag-test" doc:id="36e4172f-0a2c-4c2e-9546-8f4f30c6cc93" >
<munit:execution >
<ms-aichain:rag-load-document doc:name="Rag load document" doc:id="66b215ae-fab5-4da9-ac91-ebe1c60d6a7b" config-ref="OPENAI" contextPath='${app.home}/embeddingaddfiletest/Foundations_for_High_Scalability_in_Mule_4.pdf' fileType="any">
<ms-aichain:data>
Expand All @@ -177,7 +177,7 @@ payload.response must contain("reactive programming")]]]></munit-tools:that>
</munit:validation>
</munit:test>

<munit:test name="ChatAnswerPromptWithMemory-test" doc:id="2a57db6b-92c2-45fe-a93f-8e20d0cfedf8" >
<munit:test name="chat-answer-prompt-with-memory-test" doc:id="2a57db6b-92c2-45fe-a93f-8e20d0cfedf8" >
<munit:behavior >
<ms-aichain:chat-answer-prompt-with-memory doc:name="Chat answer prompt with memory" doc:id="d012af47-a41d-46aa-8476-39e1a2f48d92" config-ref="OPENAI" memoryName="mule" dbFilePath="target/memory-test-chat-off.db" maxMessages="10">
<ms-aichain:data>My name is Mulechain</ms-aichain:data>
Expand Down
36 changes: 36 additions & 0 deletions src/test/munit/langchain-image-models-operations-testing-suit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,40 @@ assert_expression_payload::main({payload: payload, attributes: attributes, vars:
</munit:validation>
</munit:test>

<munit:test name="image-generate-test" doc:id="b6b84e68-13f2-40d7-9486-1298c9698d97" >
<munit:execution >
<ms-aichain:image-generate doc:name="Image generate" doc:id="e698de71-aaf5-4da3-a202-7d4d5dec5814" config-ref="OPENAIGPT4">
<ms-aichain:data>
Generate a picture of a pinguin dancing on the beach, cartoon style.
</ms-aichain:data>
</ms-aichain:image-generate>
</munit:execution>
<munit:validation >
<munit-tools:assert doc:name="Assert payload" doc:id="df9a8fc1-7d0e-4181-bf08-13e27693511c" message="The payload does not match">
<munit-tools:that ><![CDATA[#[%dw 2.0
import * from dw::test::Asserts
---
payload.response must notBeNull()]]]></munit-tools:that>
</munit-tools:assert>
</munit:validation>
</munit:test>

<munit:test name="read-scanned-doc-test" doc:id="ae13a919-c5fd-469e-88b7-e89eeea77727" >
<munit:execution >
<ms-aichain:image-read-scanned-documents doc:name="Image read scanned documents" doc:id="45154a42-ce31-4b34-aadc-dc3ad10fcdc0" config-ref="OPENAIGPT4" filePath="${app.home}/scansmpl.pdf">
<ms-aichain:data>
Convert the page to json
</ms-aichain:data>
</ms-aichain:image-read-scanned-documents>
</munit:execution>
<munit:validation >
<munit-tools:assert doc:name="Assert payload" doc:id="cb078fcd-c98d-43ad-b6ae-88155d5450fd" message="The payload does not match">
<munit-tools:that ><![CDATA[#[%dw 2.0
import * from dw::test::Asserts
---
payload.pages[0].response must contain("The Slerexe Company Limited")]]]></munit-tools:that>
</munit-tools:assert>
</munit:validation>
</munit:test>

</mule>
Binary file added src/test/resources/scansmpl.pdf
Binary file not shown.