OpenAI: Stream interrupted (client disconnected) - openai-api

I'm trying OpenAI.
I have prepared the training data, and used fine_tunes.create. Several minutes later, it showed Stream interrupted (client disconnected).
$ openai api fine_tunes.create -t data_prepared.jsonl
Upload progress: 100%|██████████████████████████████████████████████| 47.2k/47.2k [00:00<00:00, 44.3Mit/s]
Uploaded file from data_prepared.jsonl: file-r6dbTH7rVsp6jJMgbX0L0bZx
Created fine-tune: ft-JRGzkYfXm7wnScUxRSBA2M2h
Streaming events until fine-tuning is complete...
(Ctrl-C will interrupt the stream, but not cancel the fine-tune)
[2022-12-02 11:10:08] Created fine-tune: ft-JRGzkYfXm7wnScUxRSBA2M2h
[2022-12-02 11:10:23] Fine-tune costs $0.06
[2022-12-02 11:10:24] Fine-tune enqueued. Queue number: 11
Stream interrupted (client disconnected).
To resume the stream, run:
openai api fine_tunes.follow -i ft-JRGzkYfXm7wnScUxRSBA2M2h
I tried fine_tunes.follow, several minutes later, it still failed:
$ openai api fine_tunes.follow -i ft-JRGzkYfXm7wnScUxRSBA2M2h
[2022-12-02 11:10:08] Created fine-tune: ft-JRGzkYfXm7wnScUxRSBA2M2h
[2022-12-02 11:10:23] Fine-tune costs $0.06
[2022-12-02 11:10:24] Fine-tune enqueued. Queue number: 11
Stream interrupted (client disconnected).
To resume the stream, run:
openai api fine_tunes.follow -i ft-JRGzkYfXm7wnScUxRSBA2M2h
openai api fine_tunes.list showed:
$ openai api fine_tunes.list
{
"data": [
{
"created_at": 1669975808,
"fine_tuned_model": null,
"hyperparams": {
"batch_size": 2,
"learning_rate_multiplier": 0.1,
"n_epochs": 4,
"prompt_loss_weight": 0.01
},
"id": "ft-JRGzkYfXm7wnScUxRSBA2M2h",
"model": "curie",
"object": "fine-tune",
"organization_id": "org-YyoQqNIrjGHYDnKt9t3T6x2J",
"result_files": [],
"status": "pending",
"training_files": [
{
"bytes": 47174,
"created_at": 1669975808,
"filename": "data_prepared.jsonl",
"id": "file-r6dbTH7rVsp6jJMgbX0L0bZx",
"object": "file",
"purpose": "fine-tune",
"status": "processed",
"status_details": null
}
],
"updated_at": 1669975824,
"validation_files": []
}
],
"object": "list"
}
And $ openai api completions.create -m ft-JRGzkYfXm7wnScUxRSBA2M2h -p aprompt returned Error: That model does not exist (HTTP status code: 404).
Could anyone help?

Apparently, there is a problem with the OpenAI API. (see: this reddit post and this issue on Git) I downgraded my version to v.0.25 by running
pip install openai==0.25.0
That fixed it for me. Although, to be fair, you can expect this to be fixed in the future.

It was a temporary issue of OpenAI, the team fixed that.

Related

How to test charge.refund.updated(status=failed) with stripe trigger in CLI?

I tried
stripe trigger charge.refund.updated \
--skip charge \
--remove refund:charge \
--add refund:payment_intent=pi_xxx \
--override refund:status='failed'
but it did not work
Stripe CLI has a feature where you could write your own fixtures and run them.
What I did in this instance is copying the fixture of charge.refund from github and modified it so it uses the card that #orakaro mentioned in his answer.
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "charge",
"path": "/v1/charges",
"method": "post",
"params": {
"source": "tok_refundFail",
"amount": 100,
"currency": "usd",
"description": "(created by Stripe CLI)"
}
},
{
"name": "refund",
"path": "/v1/refunds",
"method": "post",
"params": {
"charge": "${charge:id}"
}
}
]
}
I would save that json locally and using stripe-cli would call stripe fixtures <path-to-your-json-file> which will trigger the charge.refund.updated event with a status failed.
Your command will call /v1/refunds under the hood, and the API's parameters doesn't allow to specify status.
There is no easy way to successfully send a Create Refund API and immediately get a Refund with status = failed. But instead, you can create a PaymentIntent from a Card that guaranteed result in a failed refund.
The charge succeeds. If you initiate a refund, its status begins as
succeeded. Some time later, its status transitions to failed and sends
a charge.refund.updated webhook event.

AWS ECS create service waits for user input while showing output on console

I am using circleci job to create an ECS service. Below is the aws cli command that I'm using to create ECS service.
aws ecs create-service --cluster "test-cluster" --service-name testServiceName \
--task-definition testdef:1 \
--desired-count 1 --launch-type EC2
When this command is executing following error is occurred and the CircleCI job is failed.
{ress RETURN)
"service": {
"serviceArn": "arn:aws:ecs:*********:<account-id>:service/testServiceName",
"serviceName": "testServiceName",
"clusterArn": "arn:aws:ecs:*********:<account-id>:cluster/test-cluster",
"loadBalancers": [],
"serviceRegistries": [],
"status": "ACTIVE",
"desiredCount": 1,
"runningCount": 0,
"pendingCount": 0,
"launchType": "EC2",
"taskDefinition": "arn:aws:ecs:*********:<account-id>:task-definition/testdef*********:1",
"deploymentConfiguration": {
"maximumPercent": 200,
"minimumHealthyPercent": 100
},
"deployments": [
{
"id": "ecs-svc/1585305191116328179",
"status": "PRIMARY",
:
Too long with no output (exceeded 10m0s): context deadline exceeded
Running the command locally on a minimized terminal window gives the following output
{
"service": {
"serviceArn": "arn:aws:ecs:<region>:<account-id>:service/testServiceName",
"serviceName": "testServiceName",
"clusterArn": "arn:aws:ecs:<region>:<account-id>:cluster/test-cluster",
"loadBalancers": [],
"serviceRegistries": [],
"status": "ACTIVE",
"desiredCount": 1,
"runningCount": 0,
"pendingCount": 0,
"launchType": "EC2",
"taskDefinition": "arn:aws:ecs:<region>:<account-id>:task-definition/testdef:1",
"deploymentConfiguration": {
"maximumPercent": 200,
"minimumHealthyPercent": 100
},
"deployments": [
{
"id": "ecs-svc/8313453507891259676",
"status": "PRIMARY",
"taskDefinition": "arn:aws:ecs:<region>:<account-id>:task-definition/testdef:1",
"desiredCount": 1,
:
The further execution is stopped until I hit some key. This is the reason that CircleCI job is failing after 10m threshold limit. When I run the command in a full screen terminal locally then it does not wait and shows the output.
Is there any way that the command is run in such a way that it does not wait for any key to be hit and execution is completed so that the pipeline does not fail. Please note that the ECS service is created successfully.

How to get SIP user status with ARI?

I'm trying to make a realtime application with Asterisk 15 ARI, and I need to get all agents/users (sip) status in queue...
I need to know if the user has logged in queue, is on pause, in a call...
I'm reading the Asterisk ARI docs but not found anything about that.
I'm using node-ari-client to watch the Stasis events.
Thanks for u help.
I think AMI is more adequate for this purpose, as ARI is more suitable to build your dialplan application.
You may use AMI action QueueStatus to see who is logged in, paused, etc.
Maybe https://www.npmjs.com/package/asterisk-ami-client will help you to build the client.
ARI allows to get current state of SIP peers via
http://localhost:8088/ari/endpoints/SIP
[
{
"technology": "SIP",
"resource": "111",
"state": "online",
"channel_ids": []
},
{
"technology": "SIP",
"resource": "222",
"state": "offline",
"channel_ids": []
},
{
"technology": "SIP",
"resource": "333",
"state": "unknown",
"channel_ids": []
},
]

Request timeout in API.AI

I have an API.ai agent that sends a request (comes from the user) to a webhook which needs a lot of processing (more than 5 sec) to get the answer. As far as I know, that there is no way to increase the response timeout in API.ai
So, I have created 2 intents. The first one simply will call my webhook to start the processing the result, and at the same time the webhook will reply to the user, "Your request is under processing...".
The second intent has an event and action. The purpose of the new event is just to display the result to the user.
Once the result is ready, my backend application will send a curl statement to trigger the event in the second intent with the necessary parameter modifications like sessionID, v, and time zone … etc.
I have received the following JSON from API.AI (I created an example to simplify my case):
{ "id": "de31ee96-c42f-4f2d-8461-ee39279ec2ed", "timestamp": "2017-09-27T13:39:46.932Z", "lang": "en", "result": {
"source": "agent",
"resolvedQuery": "custom_event",
"action": "test",
"actionIncomplete": false,
"parameters": {
"user_name": "Sam"
},
"contexts": [
{
"name": "welcoming-followup",
"parameters": {
"name.original": "",
"user_name": "Sam",
"name": "",
"user_name.original": ""
},
"lifespan": 2
}
],
"metadata": {
"intentId": "c196a388-16ac-4966-b55c-7cd999a7d680",
"webhookUsed": false,
"webhookForSlotFillingUsed": "false",
"intentName": "Welcoming"
},
"fulfillment": {
"speech": "Hello Sam",
"messages": [
{
"type": 0,
"speech": "Hello Sam"
}
]
},
"score": 1.0 }, "status": {
"code": 200,
"errorType": "success" }, "sessionId": "67cb28fd-6871-750c-d668-d0b736b763ec" }
Here is the curl statement that was sent by my backend.
The curl statement is: curl -X POST -H "Content-Type: application/json; charset=utf-8" -H "Authorization: Bearer I INSERTED THE CORRECT CODE HERE" --data "{'event':{ 'name': 'custom_event', 'data': {'name': 'Sam'}}, 'timezone':'America/New_York', 'lang':'en', 'sessionId':'a6ac2555-4b19-40f8-92ec-397f6a042dde'}" "https://api.api.ai/v1/query?v=20150910"
As shown from the above JSON, the API.ai agent received the trigger successfully. But, The response that I have specified in the “Response Section” does not appear to the user.
I attached a screenshot for the second intent in the API.ai agent.
Note: I tried the agent in developer console, WebDemo and Slack. None of them shown to me (as a user) the specified response.
I am not sure if I did something wrong?
screenshot of the second intent
API.AI is not really meant to handle event-driven activities. It is meant to be the intermediary in a conversation - so the normal pattern is:
User says something
API.AI processes this, possibly with a webhook, and sends a response.
Devices such as Google Home do not have a way to get a notification, so unless the user says something (step 1), then you will never get to step 2.
When you try to trigger it manually, API.AI is treating your trigger as the step 1, and it is replying to your trigger. It has no way to send that reply back to the Assistant because it isn't having a conversation with the Assistant at that moment - it is having a conversation with however you manually triggered it.
There isn't really a good way to do what you want right now. We know notifications are coming to the Assistant eventually (it was announced at I/O 2017), but we don't know if it will have an API or what it will look like. The Transaction API does have notifications as part of it, but Transactions are meant for activities where you are purchasing or reserving something. If you need to, you can use something like Firebase Cloud Messaging to let your user know they can ask for the result, but that's a sub-optimal experience.

Not getting intended data from instagram subscription api call

I followed the subscription api(https://www.instagram.com/developer/subscriptions/) and created a subscription request like this:
curl -F 'client_id=clientId' \
-F 'client_secret=clientSecret' \
-F 'object=user' \
-F 'aspect=media' \
-F 'verify_token=my-verify-token' \
-F 'callback_url=https://xx.xx.com/igwh' \
https://api.instagram.com/v1/subscriptions/
and got response as bellow:
{
"meta": {
"code": 200
},
"data": {
"object": "user",
"object_id": null,
"aspect": "media",
"subscription_id": 0,
"callback_url": "https://xx.xx.com/igwh",
"type": "subscription",
"id": 0
}
}
My app is in live mode, so is that normal to get the "object_id": null, "subscription_id": 0 and "id": 0 onto the response?
After that when my another authenticated instagram account shared a media then I got notification to my callback url but seems to me lack of information:
[
{
"changed_aspect": "media",
"object": "user",
"object_id": "111111",
"time": 1484290271,
"subscription_id": 0,
"data": {
"media_id": "1111-11"
}
}
]
I said lack of information because a media have "id", "images", "caption", "link" etc which I was expecting as a response.
Because otherwise I have to call normal api(Media enpoints) call again to get those things. Is there anything I missed to get the subscription or have different way to get?
https://www.instagram.com/developer/subscriptions/
this endpoint says "When we have new data, we'll POST this data to your callback URL. We'll explain more about what this URL needs to do later on this page."
Although I can't get the subscription api response if I comment on the media(which I had got the notification in my callback url) or liked on the media/comment.
Is that those things not supported by instagram? Does anyone have this issue or any help will be appreciated?
May be this answer of mine will be helpful to people having same problem.

Resources