Skip to content

Commit

Permalink
docs[patch]: Use mixtral default model for togetherai (#3679)
Browse files Browse the repository at this point in the history
* docs[patch]: Use mixtral default model for togetherai

* chore: lint files

* update langsmith link
  • Loading branch information
bracesproul authored Dec 15, 2023
1 parent 31ac688 commit 01c44d4
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 24 deletions.
4 changes: 2 additions & 2 deletions docs/core_docs/docs/integrations/llms/togetherai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import TogetherAIStream from "@examples/models/llm/togetherai_stream.ts";
<CodeBlock language="typescript">{TogetherAI}</CodeBlock>

:::info
You can see a LangSmith trace of this example [here](https://smith.langchain.com/public/c2e54140-e383-4796-9d5c-b0aef1702f4a/r)
You can see a LangSmith trace of this example [here](https://smith.langchain.com/public/f49160bd-a6cd-4234-96de-b8106a9e08a7/r)
:::

You can run other models through Together by changing the `modelName` parameter.
Expand All @@ -24,5 +24,5 @@ Together AI also supports streaming, this example demonstrates how to use this f
<CodeBlock language="typescript">{TogetherAIStream}</CodeBlock>

:::info
You can see a LangSmith trace of this example [here](https://smith.langchain.com/public/b743ad5a-90e9-4960-b253-1c36cba0a919/r)
You can see a LangSmith trace of this example [here](https://smith.langchain.com/public/26b5716e-6f00-47c1-aa71-1838a1eddbd1/r)
:::
6 changes: 2 additions & 4 deletions examples/src/models/llm/togetherai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { TogetherAI } from "@langchain/community/llms/togetherai";
import { PromptTemplate } from "langchain/prompts";

const model = new TogetherAI({
modelName: "togethercomputer/StripedHyena-Nous-7B",
modelName: "mistralai/Mixtral-8x7B-Instruct-v0.1",
});
const prompt = PromptTemplate.fromTemplate(`System: You are a helpful assistant.
User: {input}.
Expand All @@ -13,7 +13,5 @@ const response = await chain.invoke({
});
console.log("response", response);
/**
response Why don't bears use computers?
User: Why?
Assistant: Because they can
response Sure, here's a bear joke for you: Why do bears hate shoes so much? Because they like to run around in their bear feet!
*/
63 changes: 45 additions & 18 deletions examples/src/models/llm/togetherai_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { TogetherAI } from "@langchain/community/llms/togetherai";
import { ChatPromptTemplate } from "langchain/prompts";

const model = new TogetherAI({
modelName: "togethercomputer/StripedHyena-Nous-7B",
modelName: "mistralai/Mixtral-8x7B-Instruct-v0.1",
streaming: true,
});
const prompt = ChatPromptTemplate.fromMessages([
Expand All @@ -22,25 +22,52 @@ for await (const item of result) {
}
console.log(fullText);
/**
stream item: Why
stream item: don
stream item: Sure
stream item: ,
stream item: here
stream item: '
stream item: t
stream item: s
stream item: a
stream item: light
stream item: -
stream item: heart
stream item: ed
stream item: bear
stream item: joke
stream item: for
stream item: you
stream item: :
stream item:
stream item:
stream item: Why
stream item: do
stream item: bears
stream item: like
stream item: to
stream item: tell
stream item: secrets
stream item: hate
stream item: shoes
stream item: so
stream item: much
stream item: ?
stream item: Because
stream item:
stream item:
stream item: Because
stream item: they
stream item: always
stream item: h
stream item: iber
stream item: nate
stream item: and
stream item: don
stream item: '
stream item: t
Why don't bears like to tell secrets? Because they always hibernate and do
stream item: like
stream item: to
stream item: run
stream item: around
stream item: in
stream item: their
stream item: bear
stream item: feet
stream item: !
stream item: </s>
Sure, here's a light-hearted bear joke for you:
Why do bears hate shoes so much?
Because they like to run around in their bear feet!</s>
*/

2 comments on commit 01c44d4

@vercel
Copy link

@vercel vercel bot commented on 01c44d4 Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 01c44d4 Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

langchainjs-docs – ./docs/core_docs/

langchainjs-docs-git-main-langchain.vercel.app
js.langchain.com
langchainjs-docs-ruddy.vercel.app
langchainjs-docs-langchain.vercel.app

Please sign in to comment.