Skip to content

Commit

Permalink
(feature, generator-cli): Generate introduction text
Browse files Browse the repository at this point in the history
  • Loading branch information
amckinney committed Jun 20, 2024
1 parent 428b352 commit 6f54759
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ exports[`cohere-go > cohere-go > generate readme 1`] = `
[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern)
[![go shield](https://img.shields.io/badge/go-docs-blue)](https://pkg.go.dev/github.com/cohere-ai/cohere-go)
The Cohere Go library provides convenient access to the Cohere API from Go.
The Cohere Go SDK allows access to Cohere models across many different platforms: the cohere platform,
AWS (Bedrock, Sagemaker), Azure, GCP and Oracle OCI. For a full list of support and snippets, please
take a look at the [SDK support docs](https://docs.cohere.com/docs/cohere-works-everywhere) page.
## Documentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"version": "2.5.2"
}
},
"introduction": "The Cohere Go SDK allows access to Cohere models across many different platforms: the cohere platform,\nAWS (Bedrock, Sagemaker), Azure, GCP and Oracle OCI. For a full list of support and snippets, please\ntake a look at the [SDK support docs](https://docs.cohere.com/docs/cohere-works-everywhere) page.",
"organization": "cohere",
"bannerLink": "https://raw.githubusercontent.com/cohere-ai/cohere-typescript/5188b11a6e91727fdd4d46f4a690419ad204224d/banner.png",
"apiReferenceLink": "https://docs.cohere.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface ReadmeConfig {
language: FernGeneratorCli.LanguageInfo;
organization: string;
bannerLink?: string;
introduction?: string;
apiReferenceLink?: string;
requirements?: string[];
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const ReadmeConfig: core.serialization.ObjectSchema<
language: LanguageInfo,
organization: core.serialization.string(),
bannerLink: core.serialization.string().optional(),
introduction: core.serialization.string().optional(),
apiReferenceLink: core.serialization.string().optional(),
requirements: core.serialization.list(core.serialization.string()).optional(),
features: core.serialization.list(ReadmeFeature).optional(),
Expand All @@ -28,6 +29,7 @@ export declare namespace ReadmeConfig {
language: LanguageInfo.Raw;
organization: string;
bannerLink?: string | null;
introduction?: string | null;
apiReferenceLink?: string | null;
requirements?: string[] | null;
features?: ReadmeFeature.Raw[] | null;
Expand Down
14 changes: 10 additions & 4 deletions clis/generator-cli/src/readme/ReadmeGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,7 @@ export class ReadmeGenerator {
});
}
writer.writeLine();
writer.writeLine(
`The ${this.organizationPascalCase} ${this.languageTitle} library provides convenient access to the ${this.organizationPascalCase} API from ${this.languageTitle}.`,
);
writer.writeLine();
this.writeIntroudction({ writer });
}

private writeBanner({ writer, bannerLink }: { writer: Writer; bannerLink: string }): void {
Expand All @@ -158,6 +155,15 @@ export class ReadmeGenerator {
);
}

private writeIntroudction({ writer }: { writer: Writer }): void {
writer.writeLine(
this.readmeConfig.introduction != null
? this.readmeConfig.introduction
: `The ${this.organizationPascalCase} ${this.languageTitle} library provides convenient access to the ${this.organizationPascalCase} API from ${this.languageTitle}.`,
);
writer.writeLine();
}

private generateDocumentation({ docsLink }: { docsLink: string }): Block {
const writer = new StringWriter();
writer.writeLine("## Documentation");
Expand Down
1 change: 1 addition & 0 deletions fern/apis/generator-cli/definition/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ types:
language: LanguageInfo
organization: string
bannerLink: optional<string>
introduction: optional<string>
apiReferenceLink: optional<string>
requirements: optional<list<string>>
features:
Expand Down

0 comments on commit 6f54759

Please sign in to comment.