mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-23 16:44:20 +01:00
👨💻 fix: prompt schema
This commit is contained in:
@@ -24,7 +24,7 @@ class Generator:
|
|||||||
self.test_description = test_description
|
self.test_description = test_description
|
||||||
|
|
||||||
def extract_content_from_result(self, plain_text, file_name, match_single_block=False):
|
def extract_content_from_result(self, plain_text, file_name, match_single_block=False):
|
||||||
pattern = fr"^\*\*{file_name}\*\*\n```(?:\w+\n)?([\s\S]*?)```"
|
pattern = fr"^\*\*{file_name}\*\*\n```(?:\w+\n)?([\s\S]*?)\n```" # the \n at the end makes sure that ``` within the generated code is not matched
|
||||||
match = re.search(pattern, plain_text, re.MULTILINE)
|
match = re.search(pattern, plain_text, re.MULTILINE)
|
||||||
if match:
|
if match:
|
||||||
return match.group(1).strip()
|
return match.group(1).strip()
|
||||||
|
|||||||
@@ -297,20 +297,7 @@ The playground must look like it was made by a professional designer.
|
|||||||
All the ui elements are well thought out to make them visually appealing and easy to use.
|
All the ui elements are well thought out to make them visually appealing and easy to use.
|
||||||
The playground contains many emojis that fit the theme of the playground and has an emoji as favicon.
|
The playground contains many emojis that fit the theme of the playground and has an emoji as favicon.
|
||||||
The playground encourages the user to deploy their own microservice by clicking on this link: https://github.com/jina-ai/gptdeploy
|
The playground encourages the user to deploy their own microservice by clicking on this link: https://github.com/jina-ai/gptdeploy
|
||||||
The playground provides a javascript code snippet that can be used to send requests to the executor. It looks like this:
|
The playground uses the following code to send a request to the microservice:
|
||||||
```javascript
|
|
||||||
(async () => {{
|
|
||||||
const deploymentId = '<your_deployment_id>';
|
|
||||||
const url = `https://gptdeploy-${deploymentId}.wolf.jina.ai/`;
|
|
||||||
const docArray = [{{ text: '...' }}];
|
|
||||||
|
|
||||||
const res = await fetch(url, {{ method: 'POST', headers: {{ 'Content-Type': 'application/json' }}, body: JSON.stringify(docArray) }});
|
|
||||||
console.log((await res.json())[0].text);
|
|
||||||
}})();
|
|
||||||
```
|
|
||||||
Make sure you put the right example data into the text attribute of the document.
|
|
||||||
|
|
||||||
This is an example how you can connect to the executor assuming the document (d) is already defined:
|
|
||||||
```
|
```
|
||||||
from jina import Client, Document, DocumentArray
|
from jina import Client, Document, DocumentArray
|
||||||
client = Client(host='http://localhost:8080')
|
client = Client(host='http://localhost:8080')
|
||||||
@@ -318,7 +305,19 @@ response = client.post('/', inputs=DocumentArray([d])) # always use '/'
|
|||||||
print(response[0].text) # can also be blob in case of image/audio..., this should be visualized in the streamlit app
|
print(response[0].text) # can also be blob in case of image/audio..., this should be visualized in the streamlit app
|
||||||
```
|
```
|
||||||
Note that the response will always be in response[0].text
|
Note that the response will always be in response[0].text
|
||||||
You must provide the complete app.py file with the exact same syntax to wrap the code.
|
The playground displays a code block containing the microservice specific curl code that can be used to send the request to the microservice.
|
||||||
|
Example:
|
||||||
|
with st.expander("See curl command"):
|
||||||
|
st.code(
|
||||||
|
'curl -X POST -H "Content-Type: application/json" -d \'[{{"text": "<different for each microservice>"}}]\' https://gptdeploy-<your_deployment_id>.wolf.jina.ai/'
|
||||||
|
language='bash'
|
||||||
|
)
|
||||||
|
|
||||||
|
You must provide the complete app.py file using the following syntax to wrap the code:
|
||||||
|
**app.py**
|
||||||
|
```python
|
||||||
|
...
|
||||||
|
```
|
||||||
The playground (app.py) must always use the host on http://localhost:8080.
|
The playground (app.py) must always use the host on http://localhost:8080.
|
||||||
The playground (app.py) must not let the user configure the host on the UI.
|
The playground (app.py) must not let the user configure the host on the UI.
|
||||||
The playground (app.py) must not import the executor.
|
The playground (app.py) must not import the executor.
|
||||||
|
|||||||
Reference in New Issue
Block a user