OpenaiAPIWiseAgentLLM
Bases: WiseAgentRemoteLLM
A class to define a WiseAgentLLM that uses the OpenAI API.
Source code in wiseagents/llm/openai_API_wise_agent_LLM.py
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
api_key
property
Get the API key.
__getstate__()
Return the state of the agent. Removing the instance variable client to avoid it is serialized/deserialized by pyyaml.
Source code in wiseagents/llm/openai_API_wise_agent_LLM.py
42 43 44 45 46 47 |
|
__init__(system_message, model_name, remote_address='http://localhost:8001/v1', api_key='sk-no-key-required')
Initialize the agent.
Parameters: |
|
---|
Source code in wiseagents/llm/openai_API_wise_agent_LLM.py
23 24 25 26 27 28 29 30 31 32 33 34 |
|
__new__(*args, **kwargs)
Create a new instance of the class, setting default values for the instance variables.
Source code in wiseagents/llm/openai_API_wise_agent_LLM.py
15 16 17 18 19 20 21 |
|
__repr__()
Return a string representation of the agent.
Source code in wiseagents/llm/openai_API_wise_agent_LLM.py
37 38 39 40 |
|
connect()
Connect to the remote machine.
Source code in wiseagents/llm/openai_API_wise_agent_LLM.py
49 50 51 52 |
|
process_chat_completion(messages, tools)
Process a chat completion. This method is implemented from superclass WiseAgentLLM. The context and state is passed in input and returned as part of the output. Deal with the messages and tools is responsibility of the caller.
Parameters: |
|
---|
Returns: |
|
---|
Source code in wiseagents/llm/openai_API_wise_agent_LLM.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
process_single_prompt(prompt)
Process a single prompt. This method is implemented from superclass WiseAgentLLM. The single prompt is processed and the result is returned, all the context and state is maintained locally in the method
Parameters: |
|
---|
Source code in wiseagents/llm/openai_API_wise_agent_LLM.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
WiseAgentLLM
Bases: YAMLObject
Abstract class to define the interface for a WiseAgentLLM.
Source code in wiseagents/llm/wise_agent_LLM.py
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 55 56 57 58 |
|
model_name
property
Get the model name.
system_message
property
Get the system message.
__init__(system_message, model_name)
Initialize the agent.
Parameters: |
|
---|
Source code in wiseagents/llm/wise_agent_LLM.py
9 10 11 12 13 14 15 16 17 18 |
|
__repr__()
Return a string representation of the agent.
Source code in wiseagents/llm/wise_agent_LLM.py
20 21 22 |
|
process_chat_completion(messages, tools)
abstractmethod
Process a chat completion. This method should be implemented by subclasses. The context and state is passed in input and returned as part of the output. Deal with the messages and tools is responsibility of the caller.
Parameters: |
|
---|
Returns: |
|
---|
Source code in wiseagents/llm/wise_agent_LLM.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
process_single_prompt(prompt)
abstractmethod
Process a single prompt. This method should be implemented by subclasses. The single prompt is processed and the result is returned, all the context and state is maintained locally in the method
Parameters: |
|
---|
Source code in wiseagents/llm/wise_agent_LLM.py
34 35 36 37 38 39 40 41 42 |
|
WiseAgentRemoteLLM
Bases: WiseAgentLLM
Extend WiseAgentLLM to support remote execution of WiseAgentLLM on a remote machine.
Source code in wiseagents/llm/wise_agent_remote_LLM.py
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 |
|
remote_address
property
Get the remote address.
__repr__()
Return a string representation of the agent.
Source code in wiseagents/llm/wise_agent_remote_LLM.py
17 18 19 |
|
process_chat_completion(messages, tools)
abstractmethod
Process a chat completion. This method should be implemented by subclasses. The context and state is passed in input and returned as part of the output. Deal with the messages and tools is responsibility of the caller.
Parameters: |
|
---|
Returns: |
|
---|
Source code in wiseagents/llm/wise_agent_remote_LLM.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
process_single_prompt(prompt)
abstractmethod
Process a single prompt. This method should be implemented by subclasses. The single prompt is processed and the result is returned, all the context and state is maintained locally in the method
Parameters: |
|
---|
Source code in wiseagents/llm/wise_agent_remote_LLM.py
26 27 28 29 30 31 32 33 34 |
|