Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ class GeminiLLM(LLM):
|
|
18 |
|
19 |
api_key: str = os.getenv("GEMINI")
|
20 |
model_name: str = "gemini-2.0-flash"
|
21 |
-
temperature: float = 0.
|
22 |
|
23 |
@property
|
24 |
def _llm_type(self) -> str:
|
@@ -36,6 +36,10 @@ class GeminiLLM(LLM):
|
|
36 |
}
|
37 |
data = {
|
38 |
"contents": [
|
|
|
|
|
|
|
|
|
39 |
{
|
40 |
"parts": [{"text": prompt}]
|
41 |
}
|
@@ -45,6 +49,7 @@ class GeminiLLM(LLM):
|
|
45 |
}
|
46 |
}
|
47 |
|
|
|
48 |
response = requests.post(url, headers=headers, json=data)
|
49 |
if response.status_code == 200:
|
50 |
result = response.json()
|
@@ -59,9 +64,6 @@ import os
|
|
59 |
|
60 |
gemini_llm = GeminiLLM()
|
61 |
|
62 |
-
prompt = PromptTemplate.from_template("Explica qué es la inteligencia artificial en pocas palabras.")
|
63 |
-
chain = LLMChain(prompt=prompt, llm=gemini_llm)
|
64 |
-
|
65 |
import os
|
66 |
from math import sqrt
|
67 |
from typing import Dict, List
|
|
|
18 |
|
19 |
api_key: str = os.getenv("GEMINI")
|
20 |
model_name: str = "gemini-2.0-flash"
|
21 |
+
temperature: float = 0.1
|
22 |
|
23 |
@property
|
24 |
def _llm_type(self) -> str:
|
|
|
36 |
}
|
37 |
data = {
|
38 |
"contents": [
|
39 |
+
{
|
40 |
+
"role": "system",
|
41 |
+
"text": "You are an agent. Please respond concisely."
|
42 |
+
},
|
43 |
{
|
44 |
"parts": [{"text": prompt}]
|
45 |
}
|
|
|
49 |
}
|
50 |
}
|
51 |
|
52 |
+
|
53 |
response = requests.post(url, headers=headers, json=data)
|
54 |
if response.status_code == 200:
|
55 |
result = response.json()
|
|
|
64 |
|
65 |
gemini_llm = GeminiLLM()
|
66 |
|
|
|
|
|
|
|
67 |
import os
|
68 |
from math import sqrt
|
69 |
from typing import Dict, List
|