diff --git a/docs/core_docs/docs/integrations/llms/togetherai.mdx b/docs/core_docs/docs/integrations/llms/togetherai.mdx index 83a4d7c4884b..aafa3b93cbe8 100644 --- a/docs/core_docs/docs/integrations/llms/togetherai.mdx +++ b/docs/core_docs/docs/integrations/llms/togetherai.mdx @@ -10,7 +10,7 @@ import TogetherAIStream from "@examples/models/llm/togetherai_stream.ts"; {TogetherAI} :::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. @@ -24,5 +24,5 @@ Together AI also supports streaming, this example demonstrates how to use this f {TogetherAIStream} :::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) ::: diff --git a/examples/src/models/llm/togetherai.ts b/examples/src/models/llm/togetherai.ts index ce7ba60fa9db..5c8f910c58c9 100644 --- a/examples/src/models/llm/togetherai.ts +++ b/examples/src/models/llm/togetherai.ts @@ -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}. @@ -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! */ diff --git a/examples/src/models/llm/togetherai_stream.ts b/examples/src/models/llm/togetherai_stream.ts index 6330157c7d22..323efa3c8f8d 100644 --- a/examples/src/models/llm/togetherai_stream.ts +++ b/examples/src/models/llm/togetherai_stream.ts @@ -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([ @@ -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: + 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! */