Skip to content

Commit

Permalink
Include example for MermaidJS
Browse files Browse the repository at this point in the history
  • Loading branch information
gsans committed Oct 13, 2023
1 parent 6f00cb5 commit 3afc409
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/app/generative-ai-palm/v1beta2/discuss.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class DiscussServiceClient {
}

async generateMessage(text: string, messages: Message[], model: string = "chat-bison-001") {
const context = "Keep your answers brief and to a single paragraph. Use markdown formatting, Katex for formulas and MermaidJS for diagrams. Always specify the language in code fences. Eg: ```HTML. Try to use at least one or more of these special formatting options when providing your answers."
const context = "Keep your answers brief and to a single paragraph. Use markdown formatting extensively, Katex for formulas and MermaidJS for diagrams. Do not use other formats. Always specify the language in code fences. Eg: ```HTML. Try to use at least one or more of these special formatting options when providing your answers."
const examples = [
{
"input": {
Expand All @@ -28,6 +28,27 @@ export class DiscussServiceClient {
"output": {
"content": "The constructor is called when an **Angular component** is created, while `ngOnInit` is called after the component's data has been initialized. This means that the constructor can be used to initialize the component's properties, while `ngOnInit` can be used to perform any additional initialization that needs to be done after the component's data has been loaded.\n\nFor example, the constructor might be used to set the initial value of a component's property, while `ngOnInit` might be used to subscribe to an observable or call a service.\n\nHere is an example of a constructor:\n\n```ts\nconstructor(private service: MyService) {}\n```\nAnd here is an example of `ngOnInit`:\n\n```ts\nngOnInit() {\n this.service.getData().subscribe(data => {\n this.data = data;\n });\n}\n```\nIn this example, the constructor is used to inject the `MyService` dependency, while `ngOnInit` is used to subscribe to the `getData` observable and update the component's data property with the data that is returned."
}
},
{
"input": {
"content": "Create a mind map using MermaidJS."
},
"output": {
"content": `
\`\`\`mermaid
mindmap
root((mindmap))
Origins
Long history
::icon(fa fa-book)
Research
On effectivness<br/>and features
Tools
Pen and paper
Mermaid
\`\`\``
}

}
];
let endpoint = this.buildEndpointUrl(model);
Expand Down

0 comments on commit 3afc409

Please sign in to comment.