Comments (10)
I am confused. How can ChatGPT provide the function of Source? I always feel that Source is at least one form of storage.
from incubator-eventmesh.
I am confused. How can ChatGPT provide the function of Source? I always feel that Source is at least one form of storage.
use the openai sdk in the chatgpt-source-connector, which likes an http server receive the request and using the openai sdk send to chatgpt service, then get response convert to cloudevents.
from incubator-eventmesh.
I want to try .
The user inputs text, and I use GPT to generate a fixed format JSON and return it to me.
This is the prompt I designed for this issue :
For the following text, extract the following information:
subject: What is the subject matter of the text? If this information is not found, output none.
datacontenttype: What type of data or information is contained in the text? If this information is not found, output none.
data: Extract all relevant data or information from the text.If this information is not found, output none.
Format the output as JSON with the following keys:
subject
datacontenttype
data
text: the subject is eventmeshSubject , the datacontenttype is json , data is eventmesh
The output should be a markdown code snippet formatted in the following schema, including the leading and trailing "```json" and "```":
```json
{
"subject": string,
"datacontenttype": string,
"data": string,
}
from incubator-eventmesh.
It's not a good idea to let GPT3.5 generate any fixed data structure.
from incubator-eventmesh.
@Pil0tXia Ok Thank you. I understand what you mean. I will continue to improve prompt and convert any input of the user into the result of cloudevents specification, instead of just limiting it to fixed.
from incubator-eventmesh.
@Pil0tXia hi this is my redesign prompt,Define the data structure within the data,The format in the data changes with the datacontenttype, which can be specified as XML, JSON, or text,Does this design meet the requirements?
You are an AI assistant named CloudEventsConverter. Your task is to convert input text provided by the user into a CloudEvents-formatted JSON object.
For the following text, extract the following information:
Create a CloudEvents-formatted JSON object with the following fields:
- specversion: Set to "1.0" (the current CloudEvents specification version)
- type: Set to \\\ targetType \\\ (you can customize this if needed)
- source: Set to \\\targetSource\\\ (you can customize this if needed)
- id: Generate a unique identifier for the event (e.g., "A234-1234-1234")
- time: Set to the current timestamp in ISO 8601 format (e.g., "2023-03-25T12:34:56.789Z")
- datacontenttype: Set to \\\ application/json \\\
- data: Set to the input text provided by the user
\\\
-orderNo
-address
-phone
\\\
text: \\\ 天津门店的13356288979的用户下单,订单号为11221122 \\\
Return the CloudEvents-formatted JSON object to the user,The format of the data field matches the datacontenttype.
Additionally, you should provide a brief explanation of the CloudEvents specification and why it is useful for describing event data in a common way across different platforms and services.
Make sure to handle cases where the user's input is unclear or does not contain any text to convert. In such cases, politely ask the user to provide input text.
Your responses should be concise, easy to understand, and focused on the task of converting input text to CloudEvents format.
result:
{
"specversion": "1.0",
"type": "targetType",
"source": "targetSource",
"id": "C789-6789-6789",
"time": "2024-03-25T10:30:15.000Z",
"datacontenttype": "application/json",
"data": {
"orderNo": "11221122",
"address": "天津门店",
"phone": "13356288979"
}
}
from incubator-eventmesh.
Actually, you don't need to ask GPT to return data in JSON format. What data GPT generates is determined by the user. The GPT source connector only needs to receive the complete response from GPT and wrap it in a CloudEvent.
from incubator-eventmesh.
Just convert it to data based on user input, and the format is passed by the user. Only a part of the functionality of my prompt is needed, right? Actually, the current data is based on the user-defined datacontenttype, and the attributes in the data are also user-defined.All data in \ \ \ is entered by the user. I should just remove the wrapper of cloudevent, accept the return of GPT in the code, and then set the data
from incubator-eventmesh.
@Pil0tXia
After the changes, do you see if they meet the requirements
You are an AI assistant named DataConverter. Your task is to convert input text provided by the user into a string.
For the following text, extract the following information:
datacontenttype is \\\ application/json \\\
Create a string with the following fields:
\\\
-year
-up
-down
\\\
text: \\\ 据晚点财经,由于净利息收入的减少,2023 年招商银行营业总收入同比下滑 1.64%、至 3391.23 亿元。这背后是去年招行公司和个人活期存款不同程度减少,定期存款分别同比大增 20.89% 和 48.58%,存款利率下调不足以对冲规模大幅上升对银行的负面影响。 具体到客户存款结构,继续着存在已久的 “二八法则”。截至 2023 年底,招行共吸纳 13.32 万亿元个人存款。其中,金葵花及以上客户(在招商银行月日均总资产超过 50 万元的个人)占 10.82 万亿元、比例达到 81.28%。 这也是招行这一级别客户的总资产首次超过 10 万亿元。而他们只占招行个人总户数的 2.35%。 同期,在招行月日均全折人民币总资产超过 1000 万元的私人银行客户,超过了 14.88 万人,较 2019 年底多了 82%。 \\\
Return the string to the user,The format of the data field matches the datacontenttype.
Make sure to handle cases where the user's input is unclear or does not contain any text to convert. In such cases, politely ask the user to provide input text.
result:
{
"year": 2023,
"up": 20.89,
"down": 1.64
}
from incubator-eventmesh.
@jevinjiang I don't think you need to define a prompt. The prompt is what the user sends to GPT, and the role of the source connector is to receive GPT's response.
from incubator-eventmesh.
Related Issues (20)
- [Bug] close tcp client failed
- [Feature] Support Opentelemetry HOT 6
- [Enhancement] Remove unuse variable responseEventMeshCommand in SendSyncMessageProcessor#processRequest HOT 3
- [Enhancement] Remove artifacts with incompatible licenses from jdbc-connector
- [Enhancement] Optimize DeleteTopicProcessor#handler method HOT 1
- [Enhancement] Upgrade Gradle from 8.2.1 to 8.7
- [Feature] Add Webhook support for HTTP Source Connector HOT 1
- [Enhancement] Optimize some configuration information of HTTP Sink Connector HOT 1
- [Question] project launch failed HOT 2
- [Enhancement] Implement retry consuming based on Pulsar message middleware HOT 3
- [Enhancement] Auto approve when dependabot's branch is changed by committers
- [Feature] Add Registry Module and Support SPI
- [Feature] Admin Server Module
- [Feature] Add and Move the Pojo Used By Both Runtime and Admin to Common
- [Feature] fix gradle dependecy and add runtime v2
- [Feature] Add Canal Connector
- [Enhancement] Upgrade jetcd-core to 0.7.7 HOT 1
- [Enhancement] Upgrade pinpoint-profiler to 3.x.x HOT 2
- [Question] Syncronize replicas of eventmesh runtime HOT 9
- [Feature] Canal Connector supports bidirectional data synchronization
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from incubator-eventmesh.