forked from microsoft/ai-sentry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleaned up logging, exception handling aorund streaming disconnects, …
…fixed bug aorund completion tokens missing on embbedding endpoints for logging workers
- Loading branch information
Showing
12 changed files
with
145 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
POST http://4.200.49.22/openai/deployments/gpt-4o/chat/completions?api-version=2024-02-15-preview HTTP/1.1 | ||
ai-sentry-consumer: Product-car-review | ||
ai-sentry-log-level: PII_STRIPPING_ENABLED | ||
ai-sentry-backend-pool: pool1 | ||
ai-sentry-adapters: ["SampleApiRequestTransformer"] | ||
Content-Type: application/json | ||
|
||
{ | ||
"messages": [ | ||
{ | ||
"role": "system", | ||
"content": "you are a car reviewer studying japenese cars" | ||
}, | ||
{ | ||
"role":"user", | ||
"content":"Write a review on toyota yaris gr" | ||
} | ||
], | ||
"stream":true, | ||
"max_tokens": 800, | ||
"temperature": 0.7, | ||
"frequency_penalty": 0, | ||
"presence_penalty": 0, | ||
"top_p": 0.95, | ||
"stop": null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
POST https://anevjes-apim-001.azure-api.net/openai-2024-02-01/deployments/gpt-4o/chat/completions?api-version=2024-02-15-preview HTTP/1.1 | ||
Content-Type: application/json | ||
|
||
{ | ||
"messages": [ | ||
{ | ||
"role": "system", | ||
"content": "you are a car reviewer studying japenese cars" | ||
}, | ||
{ | ||
"role":"user", | ||
"content":"Write a review on honda Integra DC2 Type R" | ||
} | ||
], | ||
"stream":false, | ||
"max_tokens": 800, | ||
"temperature": 0.7, | ||
"frequency_penalty": 0, | ||
"presence_penalty": 0, | ||
"top_p": 0.95, | ||
"stop": null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from locust import HttpUser, task, between | ||
|
||
class EmbeddingTestUser(HttpUser): | ||
wait_time = between(1, 5) # Simulated users will wait 1-5 seconds between tasks | ||
|
||
@task | ||
def post_embedding(self): | ||
headers = { | ||
"Content-Type": "application/json", | ||
"api-key": "your_api_key_here", # Replace with your actual API key | ||
"ai-sentry-backend-pool": "pool1", | ||
"ai-sentry-consumer": "embedding-automated-test1", | ||
"ai-sentry-log-level": "PII_STRIPPING_ENABLED", | ||
"ai-sentry-adapters": "[]" | ||
} | ||
payload = { | ||
"input": "Sample Document goes here" | ||
} | ||
self.client.post("/openai/deployments/text-embedding-ada-002/embeddings?api-version=2024-06-01", json=payload, headers=headers) | ||
|
||
# Note: Ensure you replace "your_api_key_here" with the actual API key. | ||
# You might also need to adjust the host in the Locust command-line or within the script if it's dynamic. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters