File size: 1,556 Bytes
0c7add2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15524d6
0c7add2
 
 
 
15524d6
0c7add2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

# chatbot model
model:
  _target_: modules.initialize_agent

  agent: "conversational-react-description" # langchain template for agent

  tools:
    - _target_: langchain.agents.Tool
      name: "Content Search"
      func:
        _target_: tools.SemanticSearch
        threshold: 0.5
        k: 5
      description: ^
        A content search through the UNHCR documents, it will return relevant extracts for your query.
        The action input should be a full english sentence.
        ALWAYS use this to answer ANY question. If the tool doesn't return anything, say that you don't know.
  

  llm:
    _target_: langchain.llms.OpenAI
    temperature: 0
    openai_api_key: ${oc.env:OPENAI_API_KEY} # environment variable

  memory:
    _target_: langchain.chains.conversation.memory.ConversationBufferWindowMemory
    memory_key: "chat_history"
    k: 5 # how many of the past interactions it keeps
    #verbose: True

  prefix: |
    - You are an AI whose purpose is to help answer questions.
    - You answer in a factual manner, always basing your answer on the context provided to you
    - You are free to ignore irrelevant information
    - If you do not know something, you will say that you don't know.
    - Give long answers, answering every question with a lot of detail.
    - Expand the context as you like.

    TOOLS:
    ------
    You have access to the following tools:

  suffix: |
    Begin!
    Previous conversation history:
    {chat_history}
    New input: {input}
    {agent_scratchpad}

  ai_prefix: "AI"

  verbose: True