@@ -29,20 +29,25 @@ Learn about ConvoStack and what sets it apart from other AI chatbot software:
29
29
30
30
## Getting Started
31
31
32
- Get your AI chatbot up and running in minutes with our [ quickstart repo and guide] ( https://github.com/ConvoStack/quickstart ) :
32
+ Get your AI chatbot up and running in minutes with our [ Quickstart repo and guide] ( https://github.com/ConvoStack/quickstart ) :
33
33
34
34
In the following example, we are connecting a Langchain OpenAI [ LLM] ( https://js.langchain.com/docs/modules/models/llms/ ) to the chatbot playground.
35
35
36
36
``` typescript
37
+ import * as dotenv from " dotenv" ;
38
+ // Configures the OpenAI API key
39
+ dotenv .config ();
40
+
37
41
import { playground } from " convostack/playground" ;
42
+ import { IAgentContext , IAgentResponse } from " convostack/agent" ;
38
43
import { OpenAI } from " langchain/llms/openai" ;
39
44
40
45
playground ({
41
- reply(context : IAgentContext ): Promise <IAgentResponse > {
46
+ async reply(context : IAgentContext ): Promise <IAgentResponse > {
42
47
// `humanMessage` is the content of each message the user sends via the chatbot playground.
43
48
let humanMessage = context .getHumanMessage ().content ;
44
49
// `agent` is the OpenAI agent we want to use to respond to each `humanMessage`
45
- const agent = new OpenAI ();
50
+ const agent = new OpenAI ({ modelName: " gpt-3.5-turbo " } );
46
51
// `call` is a simple string-in, string-out method for interacting with the OpenAI agent.
47
52
const resp = await model .call (humanMessage );
48
53
// `resp` is the generated agent's response to the user's `humanMessage`
0 commit comments