Skip to content

Commit 51b13e2

Browse files
style rules for marketplace (#214)
* some minor updates and organization * MP style and sample * corrected LLM token var name * prohibited * check responses better --------- Co-authored-by: Atul-Butola <atul.butola@devrev.ai>
1 parent 22bd518 commit 51b13e2

File tree

7 files changed

+82
-33
lines changed

7 files changed

+82
-33
lines changed

.github/workflows/stylecheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
id: stylecheck
3434
env:
3535
GITHUB_TOKEN: ${{ secrets.STYLECHECK }}
36-
LLM_JWT: ${{ secrets.LLM_JWT }}
36+
LLM_TOKEN: ${{ secrets.LLM_TOKEN }}
3737
REPO_OWNER: ${{ github.repository_owner }}
3838
REPO_NAME: ${{ github.event.repository.name }}
3939
PR_NUMBER: ${{ github.event.pull_request.number }}

llm_client.py

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,40 +21,34 @@ def get_response(prompt):
2121
r = requests.post('https://openwebui.dev.devrev-eng.ai/api/chat/completions', json=payload,
2222
headers=headers)
2323
r.raise_for_status()
24-
print(r)
2524

2625
if not r.text:
2726
raise ValueError("Empty response received from API")
28-
else:
29-
response = r.json()
30-
31-
if not response.get('choices'):
27+
json_response = r.json()
28+
if not json_response.get('choices'):
3229
raise ValueError("No 'choices' field in response")
33-
if not response['choices'][0].get('message'):
30+
if not json_response['choices'][0].get('message'):
3431
raise ValueError("No 'message' field in response")
35-
if not response['choices'][0]['message'].get('content'):
32+
if not json_response['choices'][0]['message'].get('content'):
3633
raise ValueError("No 'content' field in response")
37-
else:
38-
response = response['choices'][0]['message']['content']
3934

35+
response = json_response['choices'][0]['message']['content']
36+
37+
# Check if final response is empty
4038
if not response:
41-
raise ValueError("Empty content received from LLM.")
42-
else:
43-
print("Response received from LLM.")
44-
return response
39+
raise ValueError("Empty content received from API")
40+
41+
return response
4542

4643
except requests.RequestException as e:
47-
msg = f"HTTP request failed. Error: {type(e)} {e}"
48-
print(msg)
49-
return msg
44+
print(f"HTTP request failed. Error: {type(e)} {e}")
45+
return None
5046
except ValueError as e:
51-
msg = f"Invalid response received. Error: {e}"
52-
print(msg)
53-
return msg
47+
print(f"Invalid response received. Error: {e}")
48+
return None
5449
except Exception as e:
55-
msg = f"Failed to generate response. Error: {type(e)} {e}"
56-
print(msg)
57-
return msg
50+
print(f"Failed to generate response. Error: {type(e)} {e}")
51+
return None
5852

5953
def get_lines_between_tags(text, tag):
6054
pattern = r'<' + tag + r'>(.*?)<\/' + tag + r'>'

style/prompt.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
You are an expert technical documentation editor. Analyze the included document and revise it so that it adheres to the following style rules. While you can make suggestions for being more concise, be very careful not to remove any facts from the document. Also do not change the document structure, including removing the title or headings, unless the original structure violates any of the guidelines. Also check the terminology given in CSV format inside the `<terminology>` element.
1+
You are an expert technical documentation editor. Analyze the included document and revise it so that it adheres to the following style rules. While you can make suggestions for being more concise, be very careful not to remove any facts from the document. In general, make the minimum number of changes necessary to ensure that the document adheres to the guidelines. Avoid changing the document structure, including removing the title or headings, unless the original structure violates any of the guidelines. Also check the terminology given in CSV format inside the `<terminology>` element.
22

3-
In your response, summarize the violations that you fixed. Return the revised markdown inside a separate element `<document>` element, just like in this request, that contains only the document and no other commentary. I’m going to read your suggestions through an API and need to be able to get just the document for the next stage.
3+
In your response, summarize the fixes you made. Return the revised markdown inside a separate `<document>` element, just like in this request, that contains only the document and no other commentary. I’m going to read your suggestions through an API and need to be able to get just the document for the next stage.

style/sample-marketplace.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Auto Parts to Conversation
2+
3+
<img src="https://devrev.ai/marketplace/api/item-artifact/don%3Acore%3Advrv-us-1%3Adevo%2F0%3Aartifact%2F7398" align="center"/>
4+
5+
## Overview
6+
7+
The Auto Part to Conversation snap-in is a powerful tool that utilizes advanced natural language processing (NLP) capabilities to analyze customer conversations. It aims to automatically identify the specific parts discussed in a conversation, providing valuable insights for enhanced customer service.
8+
9+
## How it Works
10+
11+
Once you install the snap-in, it does the following:
12+
13+
1. Resolution assignment: When the conversation is resolved, the snap-in will automatically analyze customer conversations and identify the relevant parts being discussed. It will assign the appropriate part to the conversation based on its analysis.
14+
15+
2. No part assignment when uncertain: In cases where the snap-in is unable to confidently identify a part, it will refrain from assigning any part to the conversation, ensuring accuracy.
16+
17+
## Features
18+
19+
**Automatic part assignment**
20+
21+
The Auto Part to Conversation snap-in eliminates the need for manual intervention by automatically assigning the relevant part to a conversation.
22+
23+
**Channel compatibility**
24+
25+
It seamlessly works across various communication channels, including email, PLuG, and Slack, providing consistent functionality and efficiency.
26+
27+
**High accuracy**
28+
29+
The snap-in ensures high accuracy by assigning a part only when it has a high level of confidence, minimizing the possibility of errors.
30+
31+
## Installation
32+
33+
To enable the auto part to conversation snap-in, click the Install button and follow the installation steps.

style/style-common.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,33 @@ For the writing style, apply the following descriptive keywords to revising the
77
- Vocabulary choice: consistent, technical
88
- Grammar and syntax: structured, flawless, articulate
99
- Descriptive language: clear, concise, informative
10-
- Language variant: standard technical/professional US American English; not British, Indian, or other variants.
10+
- Language variant: standard technical/professional US American English; not British, Indian, or other variants
11+
- Prohibited: profanity, hate speech, non-inclusive words, or any other unprofessional expressions
1112

1213
There are also some very specific style rules that need to be followed:
1314

15+
- Avoid future tense when describing the behavior of the product. Use simple present instead.
16+
- Do not make any reference to how things used to be ("currently", "new") or to future plans.
17+
18+
### Titles
19+
20+
- Do not use w-words (what, why, how) in headings or titles.
21+
- Avoid starting titles with verbs except for instructions as described below.
22+
- Titles of instructions or how-to guides should be a verb in the infinitive form without “to”, not a gerund (ending in -ing). Titles of any other type of section should be noun phrases.
1423
- Use sentence case (only capitalize the first word and proper nouns) in any type of heading, including in two-level lists.
24+
25+
### Instructions or how-to guides
26+
27+
- They may use two levels; both should be ordered (numbered) lists, not unordered (bulleted) lists.
28+
- Instructions should be in imperative mood.
29+
- If there is a location or condition in a step, it should be at the front of the main clause, which must still be in imperative mood.
30+
- Steps should be more than a single "click"; combine steps if needed to make them more meaningful. If there is an outcome of the step stated, it should be part of the same step, not a new step.
31+
32+
### Lists
33+
1534
- Ensure that any list is in parallel structure (use the same syntax for every entry).
16-
- Instructions or how-to guides:
17-
- They may use two levels; both should be ordered (numbered) lists, not unordered (bulleted) lists.
18-
- Instructions should be in imperative mood.
19-
- If there is a location or condition in a step, it should be at the front of the main clause, which must still be in imperative mood.
20-
- Steps should be more than a single "click"; combine steps if needed to make them more meaningful. If there is an outcome of the step stated, it should be part of the same step, not a new step.
2135
- End each list item with a period or other appropriate sentence-ending punctuation, except in the following cases:
2236
- If the item consists of a single word, don't add end punctuation.
2337
- If the item doesn't include a verb, don't add end punctuation.
2438
- If the item is entirely in code font, don't add end punctuation.
2539
- If the item is entirely link text or a document title, don't add end punctuation.
26-
- Titles of instructions or how-to guides should be a verb in the infinitive form without “to”, not a gerund (ending in -ing). Titles of any other type of section should be noun phrases.
27-
- Avoid future tense when describing the behavior of the product. Use simple present instead.

style/style-marketplace.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## Marketplace-specific style
2+
3+
### Document structure
4+
5+
- Start with a paragraph, not a title or heading.
6+
- The first section should be an H2 titled "Features" containing a bulleted list of the snap-in features.
7+
- The second section should be an H2 titled "Installation" containing a numbered list of the installation instructions.
8+
- The third section should be an H2 titled "Configuration" containing a numbered list of the configuration instructions.
9+
- No other sections are allowed.

style/term-common.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Deprecated;Approved
22
foo;example
33
Devrev;DevRev
4+
navigate to;go to
45
RevOrg;workspace
56
RevUser;customer
67
snapin;snap-in

0 commit comments

Comments
 (0)