Skip to content

Commit b60acf8

Browse files
Update ai-agents.md
1 parent e1dab13 commit b60acf8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

articles/cosmos-db/ai-agents.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ from langchain_core.runnables.history import RunnableWithMessageHistory
393393
from langchain.agents import AgentExecutor, create_openai_tools_agent
394394
from service import TravelAgentTools as agent_tools
395395

396-
load_dotenv(override=True)
396+
load_dotenv(override=False)
397397

398398

399399
chat : ChatOpenAI | None=None
@@ -435,7 +435,7 @@ def LLM_init():
435435
LLM_init()
436436
```
437437

438-
The **init.py** file commences by initiating the loading of environment variables from a **.env** file utilizing the ```load_dotenv(override=True)``` method. Then, a global variable named ```agent_with_chat_history``` is instantiated for the agent, intended for use by our **TravelAgent.py**. The ```LLM_init()``` method is invoked during module initialization to configure our AI agent for conversation via the API web layer. The OpenAI Chat object is instantiated using the GPT-3.5 model, incorporating specific parameters such as model name and temperature. The chat object, tools list, and prompt template are combined to generate an ```AgentExecutor```, which operates as our AI Travel Agent. Lastly, the agent with history, ```agent_with_chat_history```, is established using ```RunnableWithMessageHistory``` with chat history (MongoDBChatMessageHistory), enabling it to maintain a complete conversation history via Azure Cosmos DB.
438+
The **init.py** file commences by initiating the loading of environment variables from a **.env** file utilizing the ```load_dotenv(override=False)``` method. Then, a global variable named ```agent_with_chat_history``` is instantiated for the agent, intended for use by our **TravelAgent.py**. The ```LLM_init()``` method is invoked during module initialization to configure our AI agent for conversation via the API web layer. The OpenAI Chat object is instantiated using the GPT-3.5 model, incorporating specific parameters such as model name and temperature. The chat object, tools list, and prompt template are combined to generate an ```AgentExecutor```, which operates as our AI Travel Agent. Lastly, the agent with history, ```agent_with_chat_history```, is established using ```RunnableWithMessageHistory``` with chat history (MongoDBChatMessageHistory), enabling it to maintain a complete conversation history via Azure Cosmos DB.
439439

440440
#### Prompt
441441

@@ -504,7 +504,7 @@ from model.prompt import PromptResponse
504504
import time
505505
from dotenv import load_dotenv
506506

507-
load_dotenv(override=True)
507+
load_dotenv(override=False)
508508

509509

510510
def agent_chat(input:str, session_id:str)->str:

0 commit comments

Comments
 (0)