|
10 | 10 | }, |
11 | 11 | { |
12 | 12 | "cell_type": "code", |
13 | | - "execution_count": null, |
14 | | - "metadata": {}, |
15 | | - "outputs": [], |
| 13 | + "metadata": { |
| 14 | + "ExecuteTime": { |
| 15 | + "end_time": "2024-11-27T11:14:21.734806Z", |
| 16 | + "start_time": "2024-11-27T11:14:21.726302Z" |
| 17 | + } |
| 18 | + }, |
16 | 19 | "source": [ |
17 | 20 | "from dotenv import load_dotenv, find_dotenv\n", |
18 | 21 | "\n", |
19 | 22 | "load_dotenv(find_dotenv())" |
20 | | - ] |
| 23 | + ], |
| 24 | + "outputs": [ |
| 25 | + { |
| 26 | + "data": { |
| 27 | + "text/plain": [ |
| 28 | + "True" |
| 29 | + ] |
| 30 | + }, |
| 31 | + "execution_count": 2, |
| 32 | + "metadata": {}, |
| 33 | + "output_type": "execute_result" |
| 34 | + } |
| 35 | + ], |
| 36 | + "execution_count": 2 |
21 | 37 | }, |
22 | 38 | { |
23 | 39 | "cell_type": "code", |
24 | | - "execution_count": null, |
25 | | - "metadata": {}, |
26 | | - "outputs": [], |
| 40 | + "metadata": { |
| 41 | + "ExecuteTime": { |
| 42 | + "end_time": "2024-11-27T11:14:26.599201Z", |
| 43 | + "start_time": "2024-11-27T11:14:22.819711Z" |
| 44 | + } |
| 45 | + }, |
27 | 46 | "source": [ |
28 | 47 | "from intelligence_layer.core import (\n", |
29 | | - " LuminousControlModel,\n", |
30 | 48 | " CompleteInput,\n", |
31 | | - " InMemoryTracer,\n", |
| 49 | + " InMemoryTracer, Llama3InstructModel,\n", |
32 | 50 | ")\n", |
33 | 51 | "\n", |
34 | 52 | "tracer = InMemoryTracer()\n", |
35 | 53 | "\n", |
36 | | - "model = LuminousControlModel(name=\"luminous-nextgen-7b-control-384k\")\n", |
| 54 | + "model = Llama3InstructModel(name=\"pharia-1-llm-7b-control\")\n", |
37 | 55 | "\n", |
38 | 56 | "prompt = model.to_instruct_prompt(\n", |
39 | 57 | " instruction=\"Du bist ein Assistent, der Fragen beantwortet.\",\n", |
|
42 | 60 | "complete_input = CompleteInput(prompt=prompt)\n", |
43 | 61 | "response = model.complete(complete_input, tracer=tracer)\n", |
44 | 62 | "response" |
45 | | - ] |
46 | | - }, |
47 | | - { |
48 | | - "cell_type": "code", |
49 | | - "execution_count": null, |
50 | | - "metadata": {}, |
51 | | - "outputs": [], |
52 | | - "source": [ |
53 | | - "tracer" |
54 | | - ] |
| 63 | + ], |
| 64 | + "outputs": [ |
| 65 | + { |
| 66 | + "name": "stderr", |
| 67 | + "output_type": "stream", |
| 68 | + "text": [ |
| 69 | + "/Users/jens.luecke/Library/Caches/pypoetry/virtualenvs/rag-qa-workshop-xsC4sNM2-py3.12/lib/python3.12/site-packages/aleph_alpha_client/completion.py:9: SyntaxWarning: invalid escape sequence '\\,'\n", |
| 70 | + " \"\"\"\n", |
| 71 | + "/Users/jens.luecke/Library/Caches/pypoetry/virtualenvs/rag-qa-workshop-xsC4sNM2-py3.12/lib/python3.12/site-packages/intelligence_layer/core/model.py:229: UserWarning: The provided model is not a recommended model for this model class.Make sure that the model you have selected is suited to be use for the prompt template used in this model class.\n", |
| 72 | + " warnings.warn(\n" |
| 73 | + ] |
| 74 | + }, |
| 75 | + { |
| 76 | + "name": "stdout", |
| 77 | + "output_type": "stream", |
| 78 | + "text": [ |
| 79 | + "No CLIENT_URL specified in environment, using default: https://api.aleph-alpha.com.\n" |
| 80 | + ] |
| 81 | + }, |
| 82 | + { |
| 83 | + "data": { |
| 84 | + "text/plain": [ |
| 85 | + "CompleteOutput(model_version='.unknown.', completions=[CompletionResult(log_probs=None, completion=' Köln wurde im Jahr 38 v. Chr. von den Römern gegründet und trägt seitdem den offiziellen Namen Colonia Claudia Ara Agrippinensium, abgekürzt CCAA.', completion_tokens=None, finish_reason='end_of_text', raw_completion=None)], num_tokens_prompt_total=35, num_tokens_generated=41, optimized_prompt=None)" |
| 86 | + ] |
| 87 | + }, |
| 88 | + "execution_count": 3, |
| 89 | + "metadata": {}, |
| 90 | + "output_type": "execute_result" |
| 91 | + } |
| 92 | + ], |
| 93 | + "execution_count": 3 |
55 | 94 | }, |
56 | 95 | { |
57 | 96 | "cell_type": "markdown", |
|
66 | 105 | }, |
67 | 106 | { |
68 | 107 | "cell_type": "code", |
69 | | - "execution_count": null, |
70 | | - "metadata": {}, |
71 | | - "outputs": [], |
| 108 | + "metadata": { |
| 109 | + "ExecuteTime": { |
| 110 | + "end_time": "2024-11-27T11:17:01.837205Z", |
| 111 | + "start_time": "2024-11-27T11:17:01.832043Z" |
| 112 | + } |
| 113 | + }, |
72 | 114 | "source": [ |
73 | 115 | "from intelligence_layer.core import (\n", |
74 | 116 | " TextHighlight,\n", |
75 | 117 | " TextHighlightInput,\n", |
76 | 118 | ")\n", |
77 | 119 | "from aleph_alpha_client import PromptGranularity" |
78 | | - ] |
| 120 | + ], |
| 121 | + "outputs": [], |
| 122 | + "execution_count": 5 |
79 | 123 | }, |
80 | 124 | { |
81 | 125 | "cell_type": "code", |
82 | | - "execution_count": null, |
83 | | - "metadata": {}, |
84 | | - "outputs": [], |
| 126 | + "metadata": { |
| 127 | + "ExecuteTime": { |
| 128 | + "end_time": "2024-11-27T11:17:06.261848Z", |
| 129 | + "start_time": "2024-11-27T11:17:06.258309Z" |
| 130 | + } |
| 131 | + }, |
85 | 132 | "source": [ |
86 | 133 | "instruction = (\n", |
87 | 134 | " \"Sie sind ein Assistent, der Filmkritiken klassifiziert. Sie müssen entscheiden, ob die Person den Film mochte oder nicht.\"\n", |
|
91 | 138 | " \"Nachricht: Ich habe gestern einen Film geschaut. Es ging um einen Agenten, der eine Mission erfüllen musste. Es war wirklich spannend.\"\n", |
92 | 139 | " + \" Zunächst musste der Agent eine Basis infiltrieren. Dort gab es einen Bösewicht. Blablabla. Lorem Ipsum dolor.\"\n", |
93 | 140 | ")" |
94 | | - ] |
| 141 | + ], |
| 142 | + "outputs": [], |
| 143 | + "execution_count": 6 |
| 144 | + }, |
| 145 | + { |
| 146 | + "metadata": {}, |
| 147 | + "cell_type": "code", |
| 148 | + "outputs": [], |
| 149 | + "execution_count": null, |
| 150 | + "source": "" |
95 | 151 | } |
96 | 152 | ], |
97 | 153 | "metadata": { |
|
0 commit comments