File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { BaseChatModel } from '@langchain/core/language_models/chat_models';
7
7
import { AIMessage , SystemMessage } from '@langchain/core/messages' ;
8
8
9
9
import { BaseCompleter , IBaseCompleter } from './base-completer' ;
10
+ import { COMPLETION_SYSTEM_PROMPT } from '../provider' ;
10
11
11
12
export class AnthropicCompleter implements IBaseCompleter {
12
13
constructor ( options : BaseCompleter . IOptions ) {
@@ -17,6 +18,16 @@ export class AnthropicCompleter implements IBaseCompleter {
17
18
return this . _anthropicProvider ;
18
19
}
19
20
21
+ /**
22
+ * Getter and setter for the initial prompt.
23
+ */
24
+ get prompt ( ) : string {
25
+ return this . _prompt ;
26
+ }
27
+ set prompt ( value : string ) {
28
+ this . _prompt = value ;
29
+ }
30
+
20
31
async fetch (
21
32
request : CompletionHandler . IRequest ,
22
33
context : IInlineCompletionContext
@@ -29,7 +40,7 @@ export class AnthropicCompleter implements IBaseCompleter {
29
40
30
41
const messages = [
31
42
new SystemMessage (
32
- 'You are a code-completion AI completing the following code from a Jupyter Notebook cell.'
43
+ this . _prompt
33
44
) ,
34
45
new AIMessage ( trimmedPrompt )
35
46
] ;
@@ -62,4 +73,5 @@ export class AnthropicCompleter implements IBaseCompleter {
62
73
}
63
74
64
75
private _anthropicProvider : ChatAnthropic ;
76
+ private _prompt : string = COMPLETION_SYSTEM_PROMPT ;
65
77
}
You can’t perform that action at this time.
0 commit comments