# Parameters and LLM settings in crewai v0.61.0

**URL:** <https://community.crewai.com/t/parameters-and-llm-settings-in-crewai-v0-61-0/475>\
**Category:** CrewAI Community Support\
**Created:** [September 20, 2024, 7:58am UTC](https://community.crewai.com/t/parameters-and-llm-settings-in-crewai-v0-61-0/475 "2024-09-20T07:58:15Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![theg8](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/theg8/32/328_2.png) [@theg8](https://community.crewai.com/u/theg8)\
**Post date:** [September 20, 2024, 7:58am UTC](https://community.crewai.com/t/parameters-and-llm-settings-in-crewai-v0-61-0/475/1 "2024-09-20T07:58:15Z")

</div>

import os  
from dotenv import load\_dotenv  
load\_dotenv()  
os.environ[“OPENAI\_API\_KEY”] = os.getenv(“OPENAI\_API\_KEY”)  
os.environ[“temperature”] = “0.0”  
os.environ[“top\_p”] = “0.1”

In the agent settings, set llm = ‘gpt-4o-mini-2024-07-18’

Is this setup correct for the API key and parameters like temperature and top\_p?

---

<div class="post-metadata">

**Author:** ![matt](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/matt/32/3_2.png) [@matt](https://community.crewai.com/u/matt)\
**Post date:** [September 20, 2024, 11:19am UTC](https://community.crewai.com/t/parameters-and-llm-settings-in-crewai-v0-61-0/475/2 "2024-09-20T11:19:32Z")

</div>

Im still looking into whats the correct way, please bare with

---

<div class="post-metadata">

**Author:** ![theg8](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/theg8/32/328_2.png) [@theg8](https://community.crewai.com/u/theg8)\
**Post date:** [September 20, 2024, 11:28am UTC](https://community.crewai.com/t/parameters-and-llm-settings-in-crewai-v0-61-0/475/3 "2024-09-20T11:28:25Z")

</div>

Oh okay, wait for the good news. Thank you so much. I will stick with the older version of Crewai for setting parameters for a while. 🙏

---

<div class="post-metadata">

**Author:** ![moto](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@moto](https://community.crewai.com/u/moto)\
**Post date:** [September 20, 2024, 6:51pm UTC](https://community.crewai.com/t/parameters-and-llm-settings-in-crewai-v0-61-0/475/4 "2024-09-20T18:51:29Z")

</div>

this seems to work for gemini but you have to install google.generativeai and I am going to try the same with openai.

self.gemini\_flash = genai.GenerativeModel(model\_name=“gemini/gemini-1.5-flash”, generation\_config = genai.GenerationConfig(max\_output\_tokens=8000,temperature=0.3))

---

<div class="post-metadata">

**Author:** ![moto](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@moto](https://community.crewai.com/u/moto)\
**Post date:** [September 21, 2024, 12:53am UTC](https://community.crewai.com/t/parameters-and-llm-settings-in-crewai-v0-61-0/475/5 "2024-09-21T00:53:14Z")

</div>

I think there is a way to do this by editing the LiteLLM yaml files but not sure about the conditions to do it. anyone a LiteLLM expert here. this is getting crazy.

---

<div class="post-metadata">

**Author:** ![matt](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/matt/32/3_2.png) [@matt](https://community.crewai.com/u/matt)\
**Post date:** [September 24, 2024, 2:41am UTC](https://community.crewai.com/t/parameters-and-llm-settings-in-crewai-v0-61-0/475/6 "2024-09-24T02:41:14Z")

</div>

Upgrade to latest version 0.61.3

then you can do this

```auto
llm = LLM(
    model="gpt-4",
    temperature=0.8,
    max_tokens=150,
    top_p=0.9,
    frequency_penalty=0.1,
    presence_penalty=0.1,
    stop=["END"],
    seed=42,
    base_url="https://api.openai.com/v1",
    api_key="your-api-key-here"
)
agent = Agent(llm=llm, ...)

```

Obviously change base url, api and model to your needs

And remove what ever parameters you do not need

> **[Large Language Models (LLMs) in crewAI - crewAI](https://docs.crewai.com/core-concepts/LLMs/#key-concepts)**
>
> Cutting-edge framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.

---

<div class="post-metadata">

**Author:** ![moto](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@moto](https://community.crewai.com/u/moto)\
**Post date:** [September 24, 2024, 5:59am UTC](https://community.crewai.com/t/parameters-and-llm-settings-in-crewai-v0-61-0/475/7 "2024-09-24T05:59:44Z")

</div>

@matt this seems to work fine other than for gemini models.

---

<div class="post-metadata">

**Author:** ![matt](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/matt/32/3_2.png) [@matt](https://community.crewai.com/u/matt)\
**Post date:** [September 24, 2024, 8:14am UTC](https://community.crewai.com/t/parameters-and-llm-settings-in-crewai-v0-61-0/475/8 "2024-09-24T08:14:58Z")

</div>

Just tested and works fine for me, whats the issue?

---

<div class="post-metadata">

**Author:** ![moto](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@moto](https://community.crewai.com/u/moto)\
**Post date:** [September 24, 2024, 3:08pm UTC](https://community.crewai.com/t/parameters-and-llm-settings-in-crewai-v0-61-0/475/9 "2024-09-24T15:08:11Z")

</div>

Sorry. It was my mistake.

---

<div class="post-metadata">

**Author:** ![theg8](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/theg8/32/328_2.png) [@theg8](https://community.crewai.com/u/theg8)\
**Post date:** [September 24, 2024, 4:13pm UTC](https://community.crewai.com/t/parameters-and-llm-settings-in-crewai-v0-61-0/475/10 "2024-09-24T16:13:06Z")

</div>

May I ask, as I’m a bit confused, whether `base_url` is optional or required in the following code?

from dotenv import load\_dotenv  
import os  
from crewai import LLM  
load\_dotenv()  
gpt4omini = LLM(  
model=“gpt-4o-mini-2024-07-18”,  
temperature=0.0,  
top\_p=0.1,  
api\_key=os.getenv(“OPENAI\_API\_KEY”)  
)

Thank you so much for your help. 🙏

---

<div class="post-metadata">

**Author:** ![matt](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/matt/32/3_2.png) [@matt](https://community.crewai.com/u/matt)\
**Post date:** [September 24, 2024, 4:24pm UTC](https://community.crewai.com/t/parameters-and-llm-settings-in-crewai-v0-61-0/475/11 "2024-09-24T16:24:24Z")

</div>

You do not need to set it for OpenAI, you only need to set your API key

---

<div class="post-metadata">

**Author:** ![theg8](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/theg8/32/328_2.png) [@theg8](https://community.crewai.com/u/theg8)\
**Post date:** [September 24, 2024, 4:57pm UTC](https://community.crewai.com/t/parameters-and-llm-settings-in-crewai-v0-61-0/475/12 "2024-09-24T16:57:11Z")

</div>

Thank you so much! 🥰

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex025/uploads/crewai/original/1X/ecda97e72f77c7100e0a761444b1c991925cc789.png) [@system](https://community.crewai.com/u/system)\
**Post date:** [September 25, 2024, 4:57pm UTC](https://community.crewai.com/t/parameters-and-llm-settings-in-crewai-v0-61-0/475/13 "2024-09-25T16:57:12Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
