Skip to content

Commit

Permalink
feat: enhance Azure AI support and docs consistency ✨
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Nov 19, 2024
1 parent 5b620b4 commit a5f262f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/src/content/docs/getting-started/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ AZURE_SERVERLESS_OPENAI_API_KEY=...

</Steps>

### Azure AI Models
### Azure AI Models <a href="" id="azure_serverless_models" />

The `azure_serverless_models` provider supports non-OpenAI models deployed through the Azure AI Studio serverless deployments.

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export async function parseTokenFromEnv(
throw new Error(
"AZURE_SERVERLESS_MODELS_API_ENDPOINT not configured"
)
base = cleanAzureBase(base)
base = trimTrailingSlash(base)
if (!URL.canParse(base))
throw new Error(
"AZURE_SERVERLESS_MODELS_API_ENDPOINT must be a valid URL"
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ export const OpenAIChatCompletion: ChatCompletionHandler = async (
}
}

trace.appendContent("\n\n")
if (!postReq.stream) {
const responseBody = await r.text()
doChoices(responseBody, [])
Expand Down
26 changes: 26 additions & 0 deletions packages/sample/genaisrc/consistency.genai.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
script({
model: "azure_serverless_models:AI21-Jamba-1-5-Large-etzun",
files: "docs/src/content/docs/reference/**/*.{md,mdx}",
title: "check consistency",
system: ["system.assistant", "system.annotations"],
})

const files = env.files
.slice()
.filter((f) => !!f.content && f.content.length < 30000) // avoid massive autogenerated files
.sort((l, r) => l.content.length - r.content.length) // for rendering purposes

console.log(
files
.map((file) => `${file.filename}: ${(file.content.length / 1e3) | 0}kb`)
.join("\n")
)
def("DOC", files)

$`
You are a technical documentation expert.
- Analyze the consistency, grammar, spell checking, writing quality of the content in DOC
- Analyze the consistency of all code snippets
- Report all issues using annotation format for all file. Be systematic and consistent in your analysis.
`
3 changes: 2 additions & 1 deletion packages/sample/genaisrc/summarize.genai.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ script({
def("FILE", env.files)

$`
Summarize all files in FILE in a single page.
Summarize all files in FILE in a single paragraph.
- Keep it short.
- At most 3 paragraphs.
- Consider all files at once, do NOT summarize files individually.
`

0 comments on commit a5f262f

Please sign in to comment.