diff --git a/examples/quick-start-llm/.gitignore b/examples/quick-start-llm-python/.gitignore similarity index 100% rename from examples/quick-start-llm/.gitignore rename to examples/quick-start-llm-python/.gitignore diff --git a/examples/quick-start-llm/.python-version b/examples/quick-start-llm-python/.python-version similarity index 100% rename from examples/quick-start-llm/.python-version rename to examples/quick-start-llm-python/.python-version diff --git a/examples/quick-start-llm/Makefile b/examples/quick-start-llm-python/Makefile similarity index 51% rename from examples/quick-start-llm/Makefile rename to examples/quick-start-llm-python/Makefile index f70438f834..6ce3d1995b 100644 --- a/examples/quick-start-llm/Makefile +++ b/examples/quick-start-llm-python/Makefile @@ -3,6 +3,9 @@ help: Makefile ## show list of commands @echo "" @awk 'BEGIN {FS = ":.*?## "} /[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-40s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort +# Added to skip list to avoid warnings +DISABLED_INSTRUMENTATIONS=aleph_alpha_client,chromadb,cohere,groq,haystack-ai,lancedb,llama-index,marqo,milvus,mistralai,pinecone_client,qdrant_client,replicate,together,google_cloud_aiplatform,ibm-watson-machine-learning,weaviate_client + build/docker: ## build images used by docker compose file @docker compose build @@ -13,10 +16,19 @@ start/on-docker/only-observability: ## run observability stack using docker comp @docker compose up -d otel-collector jaeger start/local-ui: start/on-docker/only-observability ## run UI app using docker compose - @OTEL_SERVICE_NAME=quick-start-llm OTEL_TRACES_EXPORTER=otlp OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4317 opentelemetry-instrument streamlit run ./app/streamlit_app.py + @OTEL_SERVICE_NAME=quick-start-llm \ + OTEL_TRACES_EXPORTER=otlp \ + OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4317 \ + OTEL_PYTHON_DISABLED_INSTRUMENTATIONS=$(DISABLED_INSTRUMENTATIONS) \ + opentelemetry-instrument streamlit run ./app/streamlit_app.py start/local-api: start/on-docker/only-observability ## run UI app using docker compose - @OTEL_SERVICE_NAME=quick-start-llm OTEL_TRACES_EXPORTER=otlp OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4317 opentelemetry-instrument python ./app/flask_app.py + @OTEL_SERVICE_NAME=quick-start-llm \ + OTEL_TRACES_EXPORTER=otlp \ + OTEL_METRICS_EXPORTER=none \ + OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4317 \ + OTEL_PYTHON_DISABLED_INSTRUMENTATIONS=$(DISABLED_INSTRUMENTATIONS) \ + opentelemetry-instrument python ./app/flask_app.py stop: ## stop all running containers @docker compose down diff --git a/examples/quick-start-llm/README.md b/examples/quick-start-llm-python/README.md similarity index 88% rename from examples/quick-start-llm/README.md rename to examples/quick-start-llm-python/README.md index d80f92749b..5ffca1b387 100644 --- a/examples/quick-start-llm/README.md +++ b/examples/quick-start-llm-python/README.md @@ -21,7 +21,9 @@ python -m venv ./_venv source _venv/bin/activate # install requirements -pip install -r app/requirements.txt +pip install -r app/requirements.llm.txt +pip install -r app/requirements.telemetry.txt +pip install -r app/requirements.app.txt # install OTel auto-instrumentation opentelemetry-bootstrap -a install diff --git a/examples/quick-start-llm/app/Dockerfile b/examples/quick-start-llm-python/app/Dockerfile similarity index 100% rename from examples/quick-start-llm/app/Dockerfile rename to examples/quick-start-llm-python/app/Dockerfile diff --git a/examples/quick-start-llm/app/example.txt b/examples/quick-start-llm-python/app/example.txt similarity index 100% rename from examples/quick-start-llm/app/example.txt rename to examples/quick-start-llm-python/app/example.txt diff --git a/examples/quick-start-llm/app/flask_app.py b/examples/quick-start-llm-python/app/flask_app.py similarity index 76% rename from examples/quick-start-llm/app/flask_app.py rename to examples/quick-start-llm-python/app/flask_app.py index c797e7c0c4..b22d5eee71 100644 --- a/examples/quick-start-llm/app/flask_app.py +++ b/examples/quick-start-llm-python/app/flask_app.py @@ -4,9 +4,10 @@ load_dotenv() # Initialize telemetry -from telemetry import init as telemetry_init, otlp_endpoint +from telemetry import init as telemetry_init tracer = telemetry_init() # run telemetry.init() before loading any other modules to capture any module-level telemetry +from opentelemetry import trace from opentelemetry.instrumentation.flask import FlaskInstrumentor # from telemetry import heartbeat as telemetry_heartbeat @@ -39,7 +40,14 @@ def summarize_text(): provider = get_provider(provider_type) summarize_text = provider.summarize(source_text) - return jsonify({ "summary": summarize_text }) + # Get trace ID from current span + span = trace.get_current_span() + trace_id = span.get_span_context().trace_id + + # Convert trace_id to a hex string + trace_id_hex = format(trace_id, '032x') + + return jsonify({"summary": summarize_text, "trace_id": trace_id_hex}) if __name__ == '__main__': print('Running on port: ' + api_port) diff --git a/examples/quick-start-llm/app/llm/provider_google_gemini.py b/examples/quick-start-llm-python/app/llm/provider_google_gemini.py similarity index 100% rename from examples/quick-start-llm/app/llm/provider_google_gemini.py rename to examples/quick-start-llm-python/app/llm/provider_google_gemini.py diff --git a/examples/quick-start-llm/app/llm/provider_openai_chatgpt.py b/examples/quick-start-llm-python/app/llm/provider_openai_chatgpt.py similarity index 100% rename from examples/quick-start-llm/app/llm/provider_openai_chatgpt.py rename to examples/quick-start-llm-python/app/llm/provider_openai_chatgpt.py diff --git a/examples/quick-start-llm/app/llm/providers.py b/examples/quick-start-llm-python/app/llm/providers.py similarity index 100% rename from examples/quick-start-llm/app/llm/providers.py rename to examples/quick-start-llm-python/app/llm/providers.py diff --git a/examples/quick-start-llm/app/requirements.app.txt b/examples/quick-start-llm-python/app/requirements.app.txt similarity index 100% rename from examples/quick-start-llm/app/requirements.app.txt rename to examples/quick-start-llm-python/app/requirements.app.txt diff --git a/examples/quick-start-llm/app/requirements.llm.txt b/examples/quick-start-llm-python/app/requirements.llm.txt similarity index 100% rename from examples/quick-start-llm/app/requirements.llm.txt rename to examples/quick-start-llm-python/app/requirements.llm.txt diff --git a/examples/quick-start-llm/app/requirements.telemetry.txt b/examples/quick-start-llm-python/app/requirements.telemetry.txt similarity index 100% rename from examples/quick-start-llm/app/requirements.telemetry.txt rename to examples/quick-start-llm-python/app/requirements.telemetry.txt diff --git a/examples/quick-start-llm/app/streamlit_app.py b/examples/quick-start-llm-python/app/streamlit_app.py similarity index 92% rename from examples/quick-start-llm/app/streamlit_app.py rename to examples/quick-start-llm-python/app/streamlit_app.py index 750d741417..eab3f82167 100644 --- a/examples/quick-start-llm/app/streamlit_app.py +++ b/examples/quick-start-llm-python/app/streamlit_app.py @@ -64,10 +64,9 @@ def callback(): # Convert trace_id to a hex string trace_id_hex = format(trace_id, '032x') - st.text(f"Trace ID: {trace_id_hex}") # Add a hyperlink to the trace visualization tool - trace_url = f"http://localhost:16686//trace/{trace_id_hex}" - st.markdown(f"[View Trace]({trace_url})") + trace_url = f"http://localhost:16686/trace/{trace_id_hex}" + st.markdown(f"[Trace ID: {trace_id_hex}]({trace_url})") except Exception as e: st.exception(f"An error occurred: {e}") diff --git a/examples/quick-start-llm/app/telemetry.py b/examples/quick-start-llm-python/app/telemetry.py similarity index 51% rename from examples/quick-start-llm/app/telemetry.py rename to examples/quick-start-llm-python/app/telemetry.py index 732c95f266..d783dbd7e7 100644 --- a/examples/quick-start-llm/app/telemetry.py +++ b/examples/quick-start-llm-python/app/telemetry.py @@ -2,26 +2,24 @@ from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter from traceloop.sdk import Traceloop - -# import openlit import os otlp_endpoint = os.getenv("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", "localhost:4317") otlp_service_name = os.getenv("OTEL_SERVICE_NAME", "quick-start-llm") def init(): - tracer = trace.get_tracer(otlp_service_name) + tracer = trace.get_tracer(otlp_service_name) - Traceloop.init( - exporter=OTLPSpanExporter(endpoint=otlp_endpoint, insecure=True), - disable_batch=True, - should_enrich_metrics=True - ) + Traceloop.init( + exporter=OTLPSpanExporter(endpoint=otlp_endpoint, insecure=True), + disable_batch=True, + should_enrich_metrics=True + ) - return tracer + return tracer # Test method to guarantee that the telemetry is working def heartbeat(tracer): - with tracer.start_as_current_span("heartbeat"): - current_span = trace.get_current_span() - current_span.set_attribute("hello", "world") + with tracer.start_as_current_span("heartbeat"): + current_span = trace.get_current_span() + current_span.set_attribute("hello", "world") diff --git a/examples/quick-start-llm/docker-compose.yaml b/examples/quick-start-llm-python/docker-compose.yaml similarity index 79% rename from examples/quick-start-llm/docker-compose.yaml rename to examples/quick-start-llm-python/docker-compose.yaml index 0079fa4abe..94eaa7c16e 100644 --- a/examples/quick-start-llm/docker-compose.yaml +++ b/examples/quick-start-llm-python/docker-compose.yaml @@ -14,6 +14,7 @@ services: - OTEL_SERVICE_NAME=quick-start-llm-ui - OTEL_TRACES_EXPORTER=otlp - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otel-collector:4317 + - OTEL_PYTHON_DISABLED_INSTRUMENTATIONS=aleph_alpha_client,chromadb,cohere,groq,haystack-ai,lancedb,llama-index,marqo,milvus,mistralai,pinecone_client,qdrant_client,replicate,together,google_cloud_aiplatform,ibm-watson-machine-learning,weaviate_client - GOOGLE_API_KEY=${GOOGLE_API_KEY} - OPENAI_API_KEY=${OPENAI_API_KEY} ports: @@ -33,6 +34,7 @@ services: - OTEL_SERVICE_NAME=quick-start-llm-api - OTEL_TRACES_EXPORTER=otlp - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otel-collector:4317 + - OTEL_PYTHON_DISABLED_INSTRUMENTATIONS=aleph_alpha_client,chromadb,cohere,groq,haystack-ai,lancedb,llama-index,marqo,milvus,mistralai,pinecone_client,qdrant_client,replicate,together,google_cloud_aiplatform,ibm-watson-machine-learning,weaviate_client - GOOGLE_API_KEY=${GOOGLE_API_KEY} - OPENAI_API_KEY=${OPENAI_API_KEY} ports: @@ -76,6 +78,7 @@ services: # Cloud-based Managed Tracetest tracetest-agent: image: kubeshop/tracetest-agent:latest + command: ["-v"] environment: # Get the required information here: https://app.tracetest.io/retrieve-token - TRACETEST_API_KEY=${TRACETEST_API_KEY} diff --git a/examples/quick-start-llm/example.txt b/examples/quick-start-llm-python/example.txt similarity index 100% rename from examples/quick-start-llm/example.txt rename to examples/quick-start-llm-python/example.txt diff --git a/examples/quick-start-llm/observability/otelcollector.config.yaml b/examples/quick-start-llm-python/observability/otelcollector.config.yaml similarity index 100% rename from examples/quick-start-llm/observability/otelcollector.config.yaml rename to examples/quick-start-llm-python/observability/otelcollector.config.yaml diff --git a/examples/quick-start-llm/requirements.dev.txt b/examples/quick-start-llm-python/requirements.dev.txt similarity index 100% rename from examples/quick-start-llm/requirements.dev.txt rename to examples/quick-start-llm-python/requirements.dev.txt diff --git a/examples/quick-start-llm-python/tests/.gitignore b/examples/quick-start-llm-python/tests/.gitignore new file mode 100644 index 0000000000..68c5d18f00 --- /dev/null +++ b/examples/quick-start-llm-python/tests/.gitignore @@ -0,0 +1,5 @@ +node_modules/ +/test-results/ +/playwright-report/ +/blob-report/ +/playwright/.cache/ diff --git a/examples/quick-start-llm-python/tests/e2e/api.spec.js b/examples/quick-start-llm-python/tests/e2e/api.spec.js new file mode 100644 index 0000000000..cee797c747 --- /dev/null +++ b/examples/quick-start-llm-python/tests/e2e/api.spec.js @@ -0,0 +1,45 @@ +// @ts-check +const { test, expect } = require('@playwright/test'); + +const geminiTraceBasedTest = require('./definitions/gemini'); +const chatgptTraceBasedTest = require('./definitions/chatgpt'); + +const { runTracebasedTest } = require('./tracetest'); + +test('generated summarized test for Gemini', async ({ request }) => { + const result = await request.post(`http://localhost:8800/summarizeText`, { + data: { + provider: "Google (Gemini)", + text: "Born in London, Turing was raised in southern England. He graduated from King's College, Cambridge, and in 1938, earned a doctorate degree from Princeton University. During World War II, Turing worked for the Government Code and Cypher School at Bletchley Park, Britain's codebreaking centre that produced Ultra intelligence. He led Hut 8, the section responsible for German naval cryptanalysis. Turing devised techniques for speeding the breaking of German ciphers, including improvements to the pre-war Polish bomba method, an electromechanical machine that could find settings for the Enigma machine. He played a crucial role in cracking intercepted messages that enabled the Allies to defeat the Axis powers in many crucial engagements, including the Battle of the Atlantic.\n\nAfter the war, Turing worked at the National Physical Laboratory, where he designed the Automatic Computing Engine, one of the first designs for a stored-program computer. In 1948, Turing joined Max Newman's Computing Machine Laboratory at the Victoria University of Manchester, where he helped develop the Manchester computers[12] and became interested in mathematical biology. Turing wrote on the chemical basis of morphogenesis and predicted oscillating chemical reactions such as the Belousov–Zhabotinsky reaction, first observed in the 1960s. Despite these accomplishments, he was never fully recognised during his lifetime because much of his work was covered by the Official Secrets Act." + } + }); + + const jsonResult = await result.json(); + expect(jsonResult).not.toBe(null); + expect(jsonResult.summary).not.toBe(null); + + const traceID = jsonResult.trace_id; + expect(traceID).not.toBe(null); + + // run trace-based test + await runTracebasedTest(geminiTraceBasedTest, traceID); +}); + +test('generated summarized test for OpenAI', async ({ request }) => { + const result = await request.post(`http://localhost:8800/summarizeText`, { + data: { + provider: "OpenAI (ChatGPT)", + text: "Born in London, Turing was raised in southern England. He graduated from King's College, Cambridge, and in 1938, earned a doctorate degree from Princeton University. During World War II, Turing worked for the Government Code and Cypher School at Bletchley Park, Britain's codebreaking centre that produced Ultra intelligence. He led Hut 8, the section responsible for German naval cryptanalysis. Turing devised techniques for speeding the breaking of German ciphers, including improvements to the pre-war Polish bomba method, an electromechanical machine that could find settings for the Enigma machine. He played a crucial role in cracking intercepted messages that enabled the Allies to defeat the Axis powers in many crucial engagements, including the Battle of the Atlantic.\n\nAfter the war, Turing worked at the National Physical Laboratory, where he designed the Automatic Computing Engine, one of the first designs for a stored-program computer. In 1948, Turing joined Max Newman's Computing Machine Laboratory at the Victoria University of Manchester, where he helped develop the Manchester computers[12] and became interested in mathematical biology. Turing wrote on the chemical basis of morphogenesis and predicted oscillating chemical reactions such as the Belousov–Zhabotinsky reaction, first observed in the 1960s. Despite these accomplishments, he was never fully recognised during his lifetime because much of his work was covered by the Official Secrets Act." + } + }); + + const jsonResult = await result.json(); + expect(jsonResult).not.toBe(null); + expect(jsonResult.summary).not.toBe(null); + + const traceID = jsonResult.trace_id; + expect(traceID).not.toBe(null); + + // run trace-based test + await runTracebasedTest(chatgptTraceBasedTest, traceID); +}); diff --git a/examples/quick-start-llm-python/tests/e2e/definitions/chatgpt.js b/examples/quick-start-llm-python/tests/e2e/definitions/chatgpt.js new file mode 100644 index 0000000000..335acce940 --- /dev/null +++ b/examples/quick-start-llm-python/tests/e2e/definitions/chatgpt.js @@ -0,0 +1,32 @@ +const definition = { + "type": "Test", + "spec": { + "id": "B9opfNRNR", + "name": "Get GPT4 trace", + "trigger": { + "type": "traceid", + "traceid": { + "id": "${var:TRACE_ID}" + } + }, + "specs": [ + { + "selector": "span[tracetest.span.type=\"general\" name=\"ChatPromptTemplate.workflow\"]", + "name": "It performed a Chat workflow", + "assertions": [ + "attr:tracetest.span.name = \"ChatPromptTemplate.workflow\"" + ] + }, + { + "selector": "span[tracetest.span.type=\"general\" name=\"openai.chat\"]", + "name": "It called OpenAI API", + "assertions": [ + "attr:name = \"openai.chat\"" + ] + } + ], + "pollingProfile": "predefined-default" + } +}; + +module.exports = definition; diff --git a/examples/quick-start-llm-python/tests/e2e/definitions/gemini.js b/examples/quick-start-llm-python/tests/e2e/definitions/gemini.js new file mode 100644 index 0000000000..1b97f28d74 --- /dev/null +++ b/examples/quick-start-llm-python/tests/e2e/definitions/gemini.js @@ -0,0 +1,32 @@ +const definition = { + "type": "Test", + "spec": { + "id": "VS0U-HgHg", + "name": "Get Gemini trace", + "trigger": { + "type": "traceid", + "traceid": { + "id": "${var:TRACE_ID}" + } + }, + "specs": [ + { + "selector": "span[tracetest.span.type=\"general\" name=\"MapReduceDocumentsChain.workflow\"]", + "name": "It triggered a Summarization workflow", + "assertions": [ + "attr:traceloop.workflow.name = \"MapReduceDocumentsChain\"" + ] + }, + { + "selector": "span[tracetest.span.type=\"general\" name=\"ChatGoogleGenerativeAI.chat\"]", + "name": "It called Gemini API at least once", + "assertions": [ + "attr:tracetest.selected_spans.count >= 1" + ] + } + ], + "pollingProfile": "predefined-default" + } +}; + +module.exports = definition; diff --git a/examples/quick-start-llm-python/tests/e2e/tracetest.js b/examples/quick-start-llm-python/tests/e2e/tracetest.js new file mode 100644 index 0000000000..72b17c9049 --- /dev/null +++ b/examples/quick-start-llm-python/tests/e2e/tracetest.js @@ -0,0 +1,13 @@ +const Tracetest = require('@tracetest/client').default; + +const { TRACETEST_API_TOKEN = '' } = process.env; + +async function runTracebasedTest(testDefinition, traceID) { + const tracetestClient = await Tracetest({ apiToken: TRACETEST_API_TOKEN }); + + const test = await tracetestClient.newTest(testDefinition); + await tracetestClient.runTest(test, { variables: [ { key: 'TRACE_ID', value: traceID }] }); + console.log(await tracetestClient.getSummary()); +} + +module.exports = { runTracebasedTest }; diff --git a/examples/quick-start-llm-python/tests/e2e/ui.spec.js b/examples/quick-start-llm-python/tests/e2e/ui.spec.js new file mode 100644 index 0000000000..67d8e3cfc7 --- /dev/null +++ b/examples/quick-start-llm-python/tests/e2e/ui.spec.js @@ -0,0 +1,70 @@ +// @ts-check +const { test, expect } = require('@playwright/test'); + +const geminiTraceBasedTest = require('./definitions/gemini'); +const chatgptTraceBasedTest = require('./definitions/chatgpt'); + +const { runTracebasedTest } = require('./tracetest'); + +const timeToWait = 10_000; // 10 seconds + +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + +test('generated summarized test for Gemini', async ({ page }) => { + // Go to Streamlit app + await page.goto('http://localhost:8501/'); + + // Select Google (Gemini) model + await page.getByTestId('stSelectbox').locator('div').filter({ hasText: 'Google (Gemini)' }).nth(2).click(); + + // Click on add example text + await page.getByRole('button', { name: 'Add example text' }).click(); + + // Click on button to call summarization rule + await page.getByRole('button', { name: 'Summarize' }).click(); + + // Wait for time + await sleep(timeToWait); + + // Capture TraceID + const traceIDLabel = await page.getByRole('link', { name: 'Trace ID' }); + expect(traceIDLabel).toHaveText('Trace ID'); + + console.log(traceIDLabel); + + // const traceID = (traceIDLabel || '').replace('Trace ID:', '').trim(); + + // // run trace-based test + // await runTracebasedTest(geminiTraceBasedTest, traceID); +}); + +// test('generated summarized test for OpenAPI', async ({ page }) => { +// // Go to Streamlit app +// await page.goto('http://localhost:8501/'); + +// // Select OpenAI (ChatGPT) model +// await page.getByTestId('stSelectbox').locator('div').filter({ hasText: 'OpenAI (ChatGPT)' }).nth(2).click(); + +// // Click on add example text +// await page.getByRole('button', { name: 'Add example text' }).click(); + +// // Click on button to call summarization rule +// await page.getByRole('button', { name: 'Summarize' }).click(); + +// // Wait for time +// await sleep(timeToWait); + +// // Capture TraceID +// const traceIDElement = await page.getByText('Trace ID:'); +// expect(traceIDElement).toHaveText('Trace ID:'); + +// const traceIDLabel = await page.getByText('Trace ID:').innerText(); +// expect(traceIDLabel).not.toBeNull(); + +// const traceID = (traceIDLabel || '').replace('Trace ID:', '').trim(); + +// // run trace-based test +// await runTracebasedTest(chatgptTraceBasedTest, traceID); +// }); diff --git a/examples/quick-start-llm-python/tests/package-lock.json b/examples/quick-start-llm-python/tests/package-lock.json new file mode 100644 index 0000000000..b6dd93fdbe --- /dev/null +++ b/examples/quick-start-llm-python/tests/package-lock.json @@ -0,0 +1,443 @@ +{ + "name": "tests", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "tests", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@tracetest/client": "^0.2.0", + "dotenv": "^16.4.5" + }, + "devDependencies": { + "@playwright/test": "^1.47.2", + "@types/node": "^22.7.4" + } + }, + "node_modules/@playwright/test": { + "version": "1.47.2", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.47.2.tgz", + "integrity": "sha512-jTXRsoSPONAs8Za9QEQdyjFn+0ZQFjCiIztAIF6bi1HqhBzG9Ma7g1WotyiGqFSBRZjIEqMdT8RUlbk1QVhzCQ==", + "dev": true, + "dependencies": { + "playwright": "1.47.2" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@tracetest/client": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@tracetest/client/-/client-0.2.0.tgz", + "integrity": "sha512-ukpmuIyHe2dfnLNpy/6p01L0kksiyJLp/occblWIdhkGBxBaf1OYe7cKB06XgoYBCDwB5gZ5rgmxGmOKCJq2WA==", + "dependencies": { + "axios": "^1.6.7", + "env-ci": "9.1.0", + "js-yaml": "^4.1.0", + "tsimportlib": "^0.0.5", + "uuid": "^9.0.1" + } + }, + "node_modules/@types/node": { + "version": "22.7.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.4.tgz", + "integrity": "sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==", + "dev": true, + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "1.7.7", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", + "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/env-ci": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/env-ci/-/env-ci-9.1.0.tgz", + "integrity": "sha512-ZCEas2sDVFR3gpumwwzSU4OJZwWJ46yqJH3TqH3vSxEBzeAlC0uCJLGAnZC0vX1TIXzHzjcwpKmUn2xw5mC/qA==", + "dependencies": { + "execa": "^7.0.0", + "java-properties": "^1.0.2" + }, + "engines": { + "node": "^16.14 || >=18" + } + }, + "node_modules/execa": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", + "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": "^14.18.0 || ^16.14.0 || >=18.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/java-properties": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/java-properties/-/java-properties-1.0.2.tgz", + "integrity": "sha512-qjdpeo2yKlYTH7nFdK0vbZWuTCesk4o63v5iVOlhMQPfuIZQfW/HI35SjfhA+4qpg36rnFSvUK5b1m+ckIblQQ==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/playwright": { + "version": "1.47.2", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.47.2.tgz", + "integrity": "sha512-nx1cLMmQWqmA3UsnjaaokyoUpdVaaDhJhMoxX2qj3McpjnsqFHs516QAKYhqHAgOP+oCFTEOCOAaD1RgD/RQfA==", + "dev": true, + "dependencies": { + "playwright-core": "1.47.2" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "node_modules/playwright-core": { + "version": "1.47.2", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.47.2.tgz", + "integrity": "sha512-3JvMfF+9LJfe16l7AbSmU555PaTl2tPyQsVInqm3id16pdDfvZ8TTZ/pyzmkbDrZTQefyzU7AIHlZqQnxpqHVQ==", + "dev": true, + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/tsimportlib": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/tsimportlib/-/tsimportlib-0.0.5.tgz", + "integrity": "sha512-qWQv/C3YB4Pwj77Z2HlORfy5EsWHcSYt66VQlMM0xZiKXwtoe1SxfpzmHX62sdJgzU6esrBGtyRIlx6O2OFPrQ==" + }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true + }, + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + } + } +} diff --git a/examples/quick-start-llm-python/tests/package.json b/examples/quick-start-llm-python/tests/package.json new file mode 100644 index 0000000000..9013136c9d --- /dev/null +++ b/examples/quick-start-llm-python/tests/package.json @@ -0,0 +1,22 @@ +{ + "name": "tests", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "record-test": "npx playwright codegen localhost:8501", + "api-tests": "npx playwright test **/*api.spec.js", + "ui-tests": "npx playwright test **/*ui.spec.js" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@playwright/test": "^1.47.2", + "@types/node": "^22.7.4" + }, + "dependencies": { + "@tracetest/client": "^0.2.0", + "dotenv": "^16.4.5" + } +} diff --git a/examples/quick-start-llm-python/tests/playwright.config.js b/examples/quick-start-llm-python/tests/playwright.config.js new file mode 100644 index 0000000000..878d75cc7a --- /dev/null +++ b/examples/quick-start-llm-python/tests/playwright.config.js @@ -0,0 +1,45 @@ +// @ts-check +const { defineConfig, devices } = require('@playwright/test'); + +// using dotenv +require('dotenv').config() + +/** + * Read environment variables from file. + * https://github.com/motdotla/dotenv + */ +// require('dotenv').config({ path: path.resolve(__dirname, '.env') }); + +/** + * @see https://playwright.dev/docs/test-configuration + */ +module.exports = defineConfig({ + testDir: './e2e', + /* Run tests in files in parallel */ + fullyParallel: true, + /* Fail the build on CI if you accidentally left test.only in the source code. */ + forbidOnly: !!process.env.CI, + /* Retry on CI only */ + retries: process.env.CI ? 2 : 0, + /* Opt out of parallel tests on CI. */ + workers: process.env.CI ? 1 : undefined, + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ + reporter: 'html', + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + use: { + /* Base URL to use in actions like `await page.goto('/')`. */ + // baseURL: 'http://127.0.0.1:3000', + + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'on-first-retry', + }, + + /* Configure projects for major browsers */ + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + ], +}); + diff --git a/examples/quick-start-llm/tests/run-chatgpt.yaml b/examples/quick-start-llm/tests/run-chatgpt.yaml deleted file mode 100644 index 378af0849a..0000000000 --- a/examples/quick-start-llm/tests/run-chatgpt.yaml +++ /dev/null @@ -1,26 +0,0 @@ -type: Test -spec: - id: aljd7ads - name: Run ChatGPT test - trigger: - type: http - httpRequest: - url: http://llm-api:8800/summarizeText - method: POST - headers: - - key: Content-Type - value: application/json - body: | - { - "provider": "OpenAI (ChatGPT)", - "text": "Born in London, Turing was raised in southern England. He graduated from King's College, Cambridge, and in 1938, earned a doctorate degree from Princeton University. During World War II, Turing worked for the Government Code and Cypher School at Bletchley Park, Britain's codebreaking centre that produced Ultra intelligence. He led Hut 8, the section responsible for German naval cryptanalysis. Turing devised techniques for speeding the breaking of German ciphers, including improvements to the pre-war Polish bomba method, an electromechanical machine that could find settings for the Enigma machine. He played a crucial role in cracking intercepted messages that enabled the Allies to defeat the Axis powers in many crucial engagements, including the Battle of the Atlantic.\n\nAfter the war, Turing worked at the National Physical Laboratory, where he designed the Automatic Computing Engine, one of the first designs for a stored-program computer. In 1948, Turing joined Max Newman's Computing Machine Laboratory at the Victoria University of Manchester, where he helped develop the Manchester computers[12] and became interested in mathematical biology. Turing wrote on the chemical basis of morphogenesis and predicted oscillating chemical reactions such as the Belousov–Zhabotinsky reaction, first observed in the 1960s. Despite these accomplishments, he was never fully recognised during his lifetime because much of his work was covered by the Official Secrets Act." - } - specs: - - selector: span[tracetest.span.type="general" service.name="quick-start-llm" name="ChatPromptTemplate.workflow"] - name: It performed a Chat workflow - assertions: - - attr:tracetest.span.name = "ChatPromptTemplate.workflow" - - selector: span[tracetest.span.type="general" service.name="quick-start-llm" name="openai.chat"] - name: It called OpenAI API - assertions: - - attr:name = "openai.chat" diff --git a/examples/quick-start-llm/tests/run-gemini.yaml b/examples/quick-start-llm/tests/run-gemini.yaml deleted file mode 100644 index b18b90ad41..0000000000 --- a/examples/quick-start-llm/tests/run-gemini.yaml +++ /dev/null @@ -1,27 +0,0 @@ -type: Test -spec: - id: WpOo9ZgHR - name: Run Gemini test - trigger: - type: http - httpRequest: - url: http://host.docker.internal:8800/summarizeText - method: POST - headers: - - key: Content-Type - value: application/json - body: | - { - "provider": "Google (Gemini)", - "text": "Born in London, Turing was raised in southern England. He graduated from King's College, Cambridge, and in 1938, earned a doctorate degree from Princeton University. During World War II, Turing worked for the Government Code and Cypher School at Bletchley Park, Britain's codebreaking centre that produced Ultra intelligence. He led Hut 8, the section responsible for German naval cryptanalysis. Turing devised techniques for speeding the breaking of German ciphers, including improvements to the pre-war Polish bomba method, an electromechanical machine that could find settings for the Enigma machine. He played a crucial role in cracking intercepted messages that enabled the Allies to defeat the Axis powers in many crucial engagements, including the Battle of the Atlantic.\n\nAfter the war, Turing worked at the National Physical Laboratory, where he designed the Automatic Computing Engine, one of the first designs for a stored-program computer. In 1948, Turing joined Max Newman's Computing Machine Laboratory at the Victoria University of Manchester, where he helped develop the Manchester computers[12] and became interested in mathematical biology. Turing wrote on the chemical basis of morphogenesis and predicted oscillating chemical reactions such as the Belousov–Zhabotinsky reaction, first observed in the 1960s. Despite these accomplishments, he was never fully recognised during his lifetime because much of his work was covered by the Official Secrets Act." - } - specs: - specs: - - selector: span[tracetest.span.type="general" service.name="quick-start-llm" name="MapReduceDocumentsChain.workflow"] - name: It triggered a Summarization workflow - assertions: - - attr:traceloop.workflow.name = "MapReduceDocumentsChain" - - selector: span[tracetest.span.type="general" service.name="quick-start-llm" name="ChatGoogleGenerativeAI.chat"] - name: It called Gemini API at least once - assertions: - - attr:tracetest.selected_spans.count >= 1