Skip to content

Commit 9f26b7a

Browse files
committed
test
1 parent 4dfb10d commit 9f26b7a

File tree

11 files changed

+19
-68
lines changed

11 files changed

+19
-68
lines changed

.github/workflows/python-ec2-genesis-test.yml renamed to .github/workflows/python-ec2-genai-test.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ env:
2121
SPANS_LOG_GROUP: aws/spans
2222
LOG_GROUP_NAME: test/genesis
2323
TEST_RESOURCES_FOLDER: ${GITHUB_WORKSPACE}
24+
SAMPLE_APP_ZIP: s3://sigv4perfresults/langchain-service.zip
2425

2526
jobs:
26-
python-ec2-adot-langchain:
27+
python-ec2-adot-genai:
2728
runs-on: ubuntu-latest
2829
timeout-minutes: 30
2930
steps:
@@ -68,20 +69,20 @@ jobs:
6869
- name: Initiate Terraform
6970
uses: ./.github/workflows/actions/execute_and_retry
7071
with:
71-
command: "cd ${{ env.TEST_RESOURCES_FOLDER }}/terraform/python/ec2/langchain && terraform init && terraform validate"
72+
command: "cd ${{ env.TEST_RESOURCES_FOLDER }}/terraform/python/ec2/adot-genai && terraform init && terraform validate"
7273
cleanup: "rm -rf .terraform && rm -rf .terraform.lock.hcl"
7374
max_retry: 6
7475

7576
- name: Deploy LangChain service via terraform
76-
working-directory: terraform/python/ec2/langchain
77+
working-directory: terraform/python/ec2/adot-genai
7778
run: |
7879
terraform apply -auto-approve \
7980
-var="aws_region=${{ env.E2E_TEST_AWS_REGION }}" \
8081
-var="test_id=${{ env.TESTING_ID }}" \
81-
-var="service_zip_url=s3://sigv4perfresults/langchain-service.zip"
82+
-var="service_zip_url=${{ env.SAMPLE_APP_ZIP }}"
8283
8384
- name: Get deployment info
84-
working-directory: terraform/python/ec2/langchain
85+
working-directory: terraform/python/ec2/adot-genai
8586
run: |
8687
echo "INSTANCE_IP=$(terraform output langchain_service_public_ip)" >> $GITHUB_ENV
8788
echo "INSTANCE_ID=$(terraform output langchain_service_instance_id)" >> $GITHUB_ENV
@@ -151,9 +152,9 @@ jobs:
151152
- name: Cleanup
152153
if: always()
153154
continue-on-error: true
154-
working-directory: terraform/python/ec2/langchain
155+
working-directory: terraform/python/ec2/adot-genai
155156
run: |
156157
terraform destroy -auto-approve \
157158
-var="aws_region=${{ env.E2E_TEST_AWS_REGION }}" \
158159
-var="test_id=${{ env.TESTING_ID }}" \
159-
-var="service_zip_url=s3://sigv4perfresults/langchain-service.zip"
160+
-var="service_zip_url=${{ env.SAMPLE_APP_ZIP }}"

sample-apps/python/langchain_service/server.py renamed to sample-apps/python/genai_service/server.py

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,12 @@ async def root():
8282
return {
8383
"message": "LangChain Bedrock OpenInference API is running!",
8484
"endpoints": {
85-
"/chat": "Single message chat endpoint",
86-
"/batch": "Batch message processing endpoint",
87-
"/sample": "Run sample prompts",
85+
"/ai-chat": "Single message chat endpoint",
8886
"/hello": "Simple hello endpoint"
8987
}
9088
}
9189

92-
@app.get("/hello")
93-
async def hello():
94-
return {"message": "Hello from LangChain service!"}
95-
96-
@app.post("/chat", response_model=ChatResponse)
90+
@app.post("/ai-chat", response_model=ChatResponse)
9791
async def chat(request: ChatRequest):
9892
"""
9993
Chat endpoint that processes a single user message through AWS Bedrock
@@ -105,40 +99,6 @@ async def chat(request: ChatRequest):
10599
except Exception as e:
106100
raise HTTPException(status_code=500, detail=str(e))
107101

108-
@app.post("/batch", response_model=BatchChatResponse)
109-
async def batch_chat(request: BatchChatRequest):
110-
"""
111-
Batch endpoint that processes multiple messages
112-
"""
113-
try:
114-
responses = []
115-
for message in request.messages:
116-
result = await chain.ainvoke({"input": message})
117-
responses.append({
118-
"message": message,
119-
"response": result["text"]
120-
})
121-
return BatchChatResponse(responses=responses)
122-
except Exception as e:
123-
raise HTTPException(status_code=500, detail=str(e))
124-
125-
@app.get("/sample", response_model=BatchChatResponse)
126-
async def run_samples():
127-
"""
128-
Run the predefined sample prompts
129-
"""
130-
try:
131-
responses = []
132-
for prompt in SAMPLE_PROMPTS:
133-
result = await chain.ainvoke({"input": prompt})
134-
responses.append({
135-
"message": prompt,
136-
"response": result["text"]
137-
})
138-
return BatchChatResponse(responses=responses)
139-
except Exception as e:
140-
raise HTTPException(status_code=500, detail=str(e))
141-
142102
@app.get("/health")
143103
async def health():
144104
"""Health check endpoint"""

sample-apps/python/langchain_service/Dockerfile

Lines changed: 0 additions & 11 deletions
This file was deleted.

sample-apps/traffic-generator/langchain/generate_traffic.sh renamed to sample-apps/traffic-generator/genai/generate_traffic.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Configuration
44
SERVER_URL="${SERVER_URL:-http://localhost:8000}"
5-
ENDPOINT="${SERVER_URL}/chat"
5+
ENDPOINT="${SERVER_URL}/ai-chat"
66
DELAY_SECONDS="${DELAY_SECONDS:-3600}" # Default 1 hour (3600 seconds) between requests
77
NUM_REQUESTS="${NUM_REQUESTS:-0}" # 0 means infinite
88
TIMEOUT="${TIMEOUT:-30}" # Request timeout in seconds

terraform/python/ec2/langchain/main.tf renamed to terraform/python/ec2/adot-genai/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ cd /app
9595
aws s3 cp ${var.service_zip_url} langchain-service.zip
9696
unzip langchain-service.zip
9797
98+
# Having issues installing dependencies from ec2-requirements.txt as these dependencies are quite large and cause timeouts/memory issues on EC2, manually installing instead
9899
python3.12 -m pip install fastapi uvicorn[standard] --no-cache-dir
99100
python3.12 -m pip install boto3 botocore setuptools --no-cache-dir
100101
python3.12 -m pip install opentelemetry-api opentelemetry-sdk opentelemetry-semantic-conventions --no-cache-dir

terraform/python/ec2/langchain/variables.tf renamed to terraform/python/ec2/adot-genai/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ variable "test_id" {
2222
}
2323

2424
variable "service_zip_url" {
25-
default = "s3://sigv4perfresults/langchain-service.zip"
25+
description = "S3 URL for the service zip file"
2626
}
2727

2828
variable "language_version" {

validator/src/main/java/com/amazon/aoc/validators/TraceValidator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ private Map<String, Object> getTrace() throws Exception {
148148
validationConfig.getHttpPath()));
149149
}
150150

151-
if (validationConfig.getHttpPath().contains("chat")) {
151+
if (validationConfig.getHttpPath().contains("ai-chat")) {
152152
return this.getTraceById(Collections.singletonList(context.getTraceId()));
153153
}
154-
154+
155155
log.info("Trace Filter: {}", traceFilter);
156156
List<TraceSummary> retrieveTraceLists = xrayService.searchTraces(traceFilter);
157157
List<String> traceIdLists = Collections.singletonList(retrieveTraceLists.get(0).getId());

validator/src/main/resources/expected-data-template/python/ec2/adot-genai/genai-trace.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"trace_id": "^{{traceId}}$",
44
"http": {
55
"request": {
6-
"url": "^.*/chat$",
6+
"url": "^.*/ai-chat$",
77
"method": "^POST$"
88
}
99
},
@@ -12,7 +12,7 @@
1212
},
1313
"annotations": {
1414
"aws.local.service": "^{{serviceName}}$",
15-
"aws.local.operation": "^POST /chat$"
15+
"aws.local.operation": "^POST /ai-chat$"
1616
},
1717
"metadata": {
1818
"service.name": "^{{serviceName}}$"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-
22
validationType: "cw-log"
3-
httpPath: "chat"
3+
httpPath: "ai-chat"
44
httpMethod: "post"
55
callingType: "http"
66
expectedLogStructureTemplate: "PYTHON_EC2_ADOT_GENAI_LOG"

0 commit comments

Comments
 (0)